code: def standardize_mapping(into):
      """
      Helper function to standardize a supplied mapping.
  
      Parameters
      ----------
      into : instance or subclass of collections.abc.Mapping
          Must be a class, an initialized collections.defaultdict,
          or an instance of a collections.abc.Mapping subclass.
  
      Returns
      -------
      mapping : a collections.abc.Mapping subclass or other constructor
          a callable object that can accept an iterator to create
          the desired Mapping.
  
      See Also
      --------
      DataFrame.to_dict
      Series.to_dict
      """
      if not inspect.isclass(into):
          if isinstance(into, defaultdict):
              return partial(defaultdict, into.default_factory)
          into = type(into)
      if not issubclass(into, abc.Mapping):
          raise TypeError(f"unsupported type: {into}")
      if into == defaultdict:
          raise TypeError(
              "to_dict() only accepts initialized defaultdicts"
          )
      return into
  
imports: from __future__ import annotations
  import builtins
  from collections import abc, defaultdict
  from collections.abc import Collection, Generator, Hashable, Iterable, Sequence
  import contextlib
  from functools import partial
  import inspect
  from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast, overload
  import warnings
  import numpy
  from pandas._libs import lib
  from pandas.compat.numpy import np_version_gte1p24
  from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
  from pandas.core.dtypes.common import is_bool_dtype, is_integer
  from pandas.core.dtypes.generic import ABCExtensionArray, ABCIndex, ABCMultiIndex, ABCSeries
  from pandas.core.dtypes.inference import iterable_not_string
label_desc: Use image node_id 23 for calling a global function with example usage: standardize_mapping(into) and returns: into, partial