def namespace_from_dict(container: dict) -> Namespace:
    """Convert a dictionary to a Namespace object recursively.

    This function takes a dictionary and recursively converts it and all nested
    dictionaries into ``Namespace`` objects. This is useful for accessing dictionary
    keys as attributes.

    Args:
        container: Dictionary to convert into a ``Namespace`` object. Can contain
            arbitrary levels of nesting.

    Returns:
        ``Namespace`` object with equivalent structure to input dictionary. Nested
        dictionaries are converted to nested ``Namespace`` objects.

    Examples:
        Basic dictionary conversion:

        >>> container = {
        ...     "dataset": {
        ...         "category": "bottle",
        ...         "image_size": 224,
        ...     },
        ...     "model_name": "padim",
        ... }
        >>> namespace = namespace_from_dict(container)
        >>> namespace.dataset.category
        'bottle'
        >>> namespace.model_name
        'padim'

        The returned object allows attribute-style access:

        >>> namespace.dataset.image_size
        224

    Note:
        All dictionary keys must be valid Python identifiers to be accessed as
        attributes in the resulting ``Namespace`` object.
    """
    output = Namespace()
    for k, v in container.items():
        if isinstance(v, dict):
            setattr(output, k, namespace_from_dict(v))
        else:
            setattr(output, k, v)
    return output
Convert a dictionary to a Namespace object recursively.

    This function takes a dictionary and recursively converts it and all nested
    dictionaries into ``Namespace`` objects. This is useful for accessing dictionary
    keys as attributes.

    Args:
        container: Dictionary to convert into a ``Namespace`` object. Can contain
            arbitrary levels of nesting.

    Returns:
        ``Namespace`` object with equivalent structure to input dictionary. Nested
        dictionaries are converted to nested ``Namespace`` objects.

    Examples:
        Basic dictionary conversion:

        >>> container = {
        ...     "dataset": {
        ...         "category": "bottle",
        ...         "image_size": 224,
        ...     },
        ...     "model_name": "padim",
        ... }
        >>> namespace = namespace_from_dict(container)
        >>> namespace.dataset.category
        'bottle'
        >>> namespace.model_name
        'padim'

        The returned object allows attribute-style access:

        >>> namespace.dataset.image_size
        224

    Note:
        All dictionary keys must be valid Python identifiers to be accessed as
        attributes in the resulting ``Namespace`` object.
    
src/anomalib/utils/config.py