def get_yaml_loader(loader=yaml.Loader, config: MkDocsConfig | None = None):
    """Wrap PyYaml's loader so we can extend it to suit our needs."""

    class Loader(loader):
        """
        Define a custom loader derived from the global loader to leave the
        global loader unaltered.
        """

    # Attach Environment Variable constructor.
    # See https://github.com/waylan/pyyaml-env-tag
    Loader.add_constructor('!ENV', yaml_env_tag.construct_env_tag)

    if config is not None:
        Loader.add_constructor('!relative', functools.partial(_construct_dir_placeholder, config))

    return Loader
Wrap PyYaml's loader so we can extend it to suit our needs.
mkdocs/utils/yaml.py