def _load_external_callbacks(group: str) -> list[Any]:
    """Collect external callbacks registered through entry points.

    The entry points are expected to be functions returning a list of callbacks.

    Args:
        group: The entry point group name to load callbacks from.

    Return:
        A list of all callbacks collected from external factories.

    """
    factories = (
        entry_points(group=group) if _PYTHON_GREATER_EQUAL_3_10_0 else entry_points().get(group, {})  # type: ignore[arg-type]
    )

    external_callbacks: list[Any] = []
    for factory in factories:
        callback_factory = factory.load()
        callbacks_list: Union[list[Any], Any] = callback_factory()
        callbacks_list = [callbacks_list] if not isinstance(callbacks_list, list) else callbacks_list
        if callbacks_list:
            _log.info(
                f"Adding {len(callbacks_list)} callbacks from entry point '{factory.name}':"
                f" {', '.join(type(cb).__name__ for cb in callbacks_list)}"
            )
        external_callbacks.extend(callbacks_list)
    return external_callbacks
Collect external callbacks registered through entry points.

    The entry points are expected to be functions returning a list of callbacks.

    Args:
        group: The entry point group name to load callbacks from.

    Return:
        A list of all callbacks collected from external factories.

    
src/lightning/fabric/utilities/registry.py