code: def standardize_mapping(into):
      """
      Helper function to standardize a supplied mapping.
  
      .. versionadded:: 0.21.0
  
      Parameters
      ----------
      into : instance or subclass of collections.Mapping
          Must be a class, an initialized collections.defaultdict,
          or an instance of a collections.Mapping subclass.
  
      Returns
      -------
      mapping : a collections.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, collections.defaultdict):
              return partial(
                  collections.defaultdict, into.default_factory
              )
          into = type(into)
      if not issubclass(into, compat.Mapping):
          raise TypeError("unsupported type: {into}".format(into=into))
      elif into == collections.defaultdict:
          raise TypeError(
              "to_dict() only accepts initialized defaultdicts"
          )
      return into
  
imports: import collections
  from datetime import datetime, timedelta
  from functools import partial
  import inspect
  import numpy
  from pandas._libs import lib, tslibs
  import pandas.compat
  from pandas.compat import PY36, OrderedDict, iteritems
  from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
  from pandas.core.dtypes.common import is_array_like, is_bool_dtype, is_extension_array_dtype, is_integer
  from pandas.core.dtypes.generic import ABCIndex, ABCIndexClass, ABCSeries
  from pandas.core.dtypes.inference import _iterable_not_string
  from pandas.core.dtypes.missing import isna, isnull, notnull
label_desc: Use image node_id 24 for calling a global function with example usage: standardize_mapping(into) and returns: into, partial