code: 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
  
imports: from __future__ import annotations
  import functools
  import logging
  import os
  import os.path
  from typing import IO, TYPE_CHECKING, Any
  import mergedeep
  import yaml
  import yaml.constructor
  import yaml_env_tag
  from mkdocs import exceptions
label_desc: Use image node_id 2 for calling a global function with example usage: get_yaml_loader(loader, config) and returns: Loader