code: def expand_configuration(
      config: dict,
      root_dir: Optional[_Path] = None,
      ignore_option_errors: bool = False,
      dist: Optional["Distribution"] = None,
  ) -> dict:
      """Given a configuration with unresolved fields (e.g. dynamic, cmdclass, ...)
      find their final values.
  
      :param dict config: Dict containing the configuration for the distribution
      :param str root_dir: Top-level directory for the distribution/project
          (the same directory where ``pyproject.toml`` is place)
      :param bool ignore_option_errors: see :func:`read_configuration`
      :param Distribution|None: Distribution object to which the configuration refers.
          If not given a dummy object will be created and discarded after the
          configuration is read. Used in the case a dynamic configuration
          (e.g. ``attr`` or ``cmdclass``).
  
      :rtype: dict
      """
      return _ConfigExpander(
          config, root_dir, ignore_option_errors, dist
      ).expand()
  
imports: import logging
  import os
  from contextlib import contextmanager
  from functools import partial
  from typing import TYPE_CHECKING, Callable, Dict, Mapping, Optional, Set, Union
  from ..errors import FileError, InvalidConfigError
  from ..warnings import SetuptoolsWarning
  from .None import expand
  from ._apply_pyprojecttoml import _PREVIOUSLY_DEFINED, _MissingDynamic
  from ._apply_pyprojecttoml import apply
label_desc: Use image node_id 5 for calling a global function with example usage: expand_configuration(config, root_dir, ignore_option_errors, dist) and returns: _ConfigExpander