def all_collections_get(context):
    """Iterator over all scene collections
    """
    def all_collections_recursive_get(collection_parent, collections):
        collections.append(collection_parent)
        for collection_nested in collection_parent.collections:
            all_collections_recursive_get(collection_nested, collections)

    scene = context.scene
    master_collection = scene.master_collection

    collections = []

    all_collections_recursive_get(master_collection, collections)

    return collections