code: def _build_field_type_map(base_class):
      
      mapping = {}
  
      for cls in _get_recursive_subclasses(base_class):
          if cls.field_type:
              if isinstance(cls.field_type, tuple):
                  for field_type in cls.field_type:
                      mapping[field_type] = cls
              elif isinstance(cls.field_type, _string_types):
                  mapping[cls.field_type] = cls
              else:
                  raise ValueError('Field type must be str or tuple, cannot understand type "{}" on class "{}"'.format(
                      type(cls.field_type),
                      cls
                  ))
  
      return mapping
docs: Create mapping from all $type values to their respective Field classes