def group_in_collection(objs, name: str, reuse=True, **kwargs):
    """
    objs: List of (None | Blender Object | List[Blender Object])
    """

    collection = get_collection(name, reuse=reuse)

    for obj in objs:
        if obj is None:
            continue
        if not isinstance(obj, list):
            obj = [obj]
        for child in obj:
            traverse_children(
                child, lambda obj: put_in_collection(obj, collection, **kwargs)
            )

    return collection

    objs: List of (None | Blender Object | List[Blender Object])
    
infinigen/core/util/blender.py