code: def get_or_new_from_json_dict_with_types(
              data, cls_map, type_key='type'
      ):
          
          if isinstance(data, tuple(cls_map.values())):
              return data
          elif isinstance(data, dict):
              type_val = data[type_key]
              if type_val in cls_map:
                  return cls_map[type_val].new_from_json_dict(data)
  
          return None
docs: Get `cls` object w/ deserialization from json by using type key hint if needed.
  
          If data is instance of one of cls, return data.
          Else if data is instance of dict, create instance from dict.
          Else, return None.
  
          :param data:
          :param cls_map:
          :param type_key:
          :rtype: object
          :return: