user: Provide the full official documentation entry for BlendDataLibraries(bpy_struct), preserving all code examples.

assistant: # BlendDataLibraries(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.BlendDataLibraries(*bpy_struct*)
:   Collection of libraries

    tag(*value*)
    :   tag

        Parameters:
        :   **value** (*boolean*) – Value

    remove(*library*, *\**, *do_unlink=True*, *do_id_user=True*, *do_ui_user=True*)
    :   Remove a library from the current blendfile

        Parameters:
        :   - **library** ([`Library`](bpy.types.Library.html#bpy.types.Library "bpy.types.Library"), (never None)) – Library to remove
            - **do_unlink** (*boolean**,* *(**optional**)*) – Unlink all usages of this library before deleting it
            - **do_id_user** (*boolean**,* *(**optional**)*) – Decrement user counter of all data-blocks used by this library
            - **do_ui_user** (*boolean**,* *(**optional**)*) – Make sure interface does not reference this library

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type

    load(*filepath*, *\**, *link=False*, *relative=False*, *set_fake=False*, *recursive=False*, *reuse_local_id=False*, *assets_only=False*, *clear_asset_data=False*, *create_liboverrides=False*, *reuse_liboverrides=False*, *create_liboverrides_runtime=False*)
    :   Returns a context manager which exposes 2 library objects on entering.
        Each object has attributes matching bpy.data which are lists of strings to be linked.

        Parameters:
        :   - **filepath** (*str* *|* *bytes*) – The path to a blend file.
            - **link** (*bool*) – When False reference to the original file is lost.
            - **pack** (*bool*) – If True, and `link` is also True, pack linked data-blocks into the current blend-file.
            - **relative** (*bool*) – When True the path is stored relative to the open blend file.
            - **set_fake** (*bool*) – If True, set fake user on appended IDs.
            - **recursive** (*bool*) – If True, also make indirect dependencies of appended libraries local.
            - **reuse_local_id** (*bool*) – If True,try to re-use previously appended matching ID on new append.
            - **assets_only** (*bool*) – If True, only list data-blocks marked as assets.
            - **clear_asset_data** (*bool*) – If True, clear the asset data on append (it is always kept for linked data).
            - **create_liboverrides** (*bool*) – If True and `link` is True, liboverrides will
              be created for linked data.
            - **reuse_liboverrides** (*bool*) – If True and `create_liboverride` is True,
              search for existing liboverride first.
            - **create_liboverrides_runtime** (*bool*) – If True and `create_liboverride` is True,
              create (or search for existing) runtime liboverride.

        ```
        import bpy

        filepath = "//link_library.blend"

        # Load a single scene we know the name of.
        with bpy.data.libraries.load(filepath) as (data_src, data_dst):
            data_dst.scenes = ["Scene"]

        # Load all meshes.
        with bpy.data.libraries.load(filepath) as (data_src, data_dst):
            data_dst.meshes = data_src.meshes

        # Link all objects starting with "A".
        with bpy.data.libraries.load(filepath, link=True) as (data_src, data_dst):
            data_dst.objects = [name for name in data_src.objects if name.startswith("A")]

        # Append everything.
        with bpy.data.libraries.load(filepath) as (data_src, data_dst):
            for attr in dir(data_dst):
                setattr(data_dst, attr, getattr(data_src, attr))

        # The loaded objects can be accessed from `data_dst` outside of the context
        # since loading the data replaces the strings for the data-blocks or None
        # if the data-block could not be loaded.
        with bpy.data.libraries.load(filepath) as (data_src, data_dst):
            data_dst.meshes = data_src.meshes
        # Now operate directly on the loaded data.
        for mesh in data_dst.meshes:
            if mesh is not None:
                print(mesh.name)
        ```

    write(*filepath*, *datablocks*, *\**, *path_remap=False*, *fake_user=False*, *compress=False*)
    :   Write data-blocks into a blend file.

        Parameters:
        :   - **filepath** (*str* *|* *bytes*) – The path to write the blend-file.
            - **datablocks** (set[[`bpy.types.ID`](bpy.types.ID.html#bpy.types.ID "bpy.types.ID")]) – set of data-blocks.
            - **path_remap** (*str*) –

              Optionally remap paths when writing the file:

              - `NONE` No path manipulation (default).
              - `RELATIVE` Remap paths that are already relative to the new location.
              - `RELATIVE_ALL` Remap all paths to be relative to the new location.
              - `ABSOLUTE` Make all paths absolute on writing.
            - **fake_user** (*bool*) – When True, data-blocks will be written with fake-user flag enabled.
            - **compress** (*bool*) – When True, write a compressed blend file.

        ```
        import bpy

        filepath = "//new_library.blend"

        # Write selected objects and their data to a blend file.
        data_blocks = set(bpy.context.selected_objects)
        bpy.data.libraries.write(filepath, data_blocks)

        # Write all meshes starting with a capital letter and
        # set them with fake-user enabled so they aren't lost on re-saving.
        data_blocks = {mesh for mesh in bpy.data.meshes if mesh.name[:1].isupper()}
        bpy.data.libraries.write(filepath, data_blocks, fake_user=True)

        # Write all materials, textures and node groups to a library.
        data_blocks = {*bpy.data.materials, *bpy.data.textures, *bpy.data.node_groups}
        bpy.data.libraries.write(filepath, data_blocks)
        ```