docs: def to_mapping_field(cls, key):  # pragma: no mccabe
      """
      Returns a callable instance that will convert a value to a Mapping.
  
      :param cls: Valid class type of the items in the Sequence.
      :param key: Attribute name of the key value in each item of cls instance.
      :return: instance of the MappingConverter.
      """
      class MappingConverter(object):
  
          def __init__(self, cls, key):
              self._cls = cls
              self.key = key
  
          @property
          def cls(self):
              return resolve_class(self._cls)
  
          def __call__(self, values):
              kwargs = OrderedDict()
  
              if isinstance(values, TypedMapping):
                  return values
  
              if not isinstance(values, (type({}), type(None))):
                  raise TypeError("Invalid type : {}".format(type(values)))
  
              if values:
                  for key_value, item in values.items():
                      if isinstance(item, dict):
                          item[self.key] = key_value
                          item = to_model(self.cls, item)
                      kwargs[key_value] = item
  
              return TypedMapping(cls=self.cls, kwargs=kwargs, key=self.key)
  
      return MappingConverter(cls, key)