Putting objects in collections, changing collection names, setting collection instsance offset

Using EasyBPY I came up with this

from easybpy import *

target = selected_objects()[0]
collection_name = target.name
create_collection( collection_name )
move_object_to_collection( target, collection_name)
target_position = location(target)
thecollection = get_collection( collection_name )
thecollection.instance_offset = target_position
from easybpy import *

target = selected_objects()[0]
thecollection = create_collection( target.name )
move_object_to_collection( target, thecollection )
thecollection.instance_offset = location(target)

import bpy

for obj in bpy.context.selected_objects:
    for existing_col in obj.users_collection:
        existing_col.objects.unlink(obj)
    col = bpy.data.collections.new(obj.name)
    bpy.context.scene.collection.children.link(col)
    col.objects.link(obj)
    col.instance_offset = obj.location