code: def load_config(
      config_file: str | IO | None = None,
      *,
      config_file_path: str | None = None,
      **kwargs,
  ) -> MkDocsConfig:
      """
      Load the configuration for a given file object or name.
  
      The config_file can either be a file object, string or None. If it is None
      the default `mkdocs.yml` filename will loaded.
  
      Extra kwargs are passed to the configuration to replace any default values
      unless they themselves are None.
      """
      options = kwargs.copy()
  
      # Filter None values from the options. This usually happens with optional
      # parameters from Click.
      for key, value in options.copy().items():
          if value is None:
              options.pop(key)
  
      with _open_config_file(config_file) as fd:
          # Initialize the config with the default schema.
          from mkdocs.config.defaults import MkDocsConfig
  
          if config_file_path is None:
              if fd is not sys.stdin.buffer:
                  config_file_path = getattr(fd, "name", None)
          cfg = MkDocsConfig(config_file_path=config_file_path)
          # load the config file
          cfg.load_file(fd)
  
      # Then load the options to overwrite anything in the config.
      cfg.load_dict(options)
  
      errors, warnings = cfg.validate()
  
      for config_name, warning in warnings:
          log.warning(f"Config value '{config_name}': {warning}")
  
      for config_name, error in errors:
          log.error(f"Config value '{config_name}': {error}")
  
      for key, value in cfg.items():
          log.debug(f"Config value '{key}' = {value!r}")
  
      if len(errors) > 0:
          raise exceptions.Abort("Aborted with a configuration error!")
      elif cfg.strict and len(warnings) > 0:
          raise exceptions.Abort(
              f"Aborted with {len(warnings)} configuration warnings in 'strict' mode!"
          )
  
      return cfg
  
imports: from __future__ import annotations
  import functools
  import logging
  import os
  import sys
  import warnings
  from collections import UserDict
  from contextlib import contextmanager
  from typing import IO, TYPE_CHECKING, Any, Generic, Iterator, List, Mapping, Sequence, Tuple, TypeVar, overload
  from mkdocs import exceptions, utils
  from mkdocs.utils import weak_property
label_desc: Use image node_id 3 for calling a global function with example usage: load_config(config_file) and returns: cfg