docs: def to_model(cls, value):
      """
      Coerce a value into a model object based on a class-type (cls).
      :param cls: class type to coerce into
      :param value: value to be coerced
      :return: original value or coerced value (value')
      """
  
      if isinstance(value, cls) or value is None:
          pass  # skip if right type or value is None
  
      elif issubclass(cls, Enum):
          value = cls(value)
  
      elif is_model(cls) and isinstance(value, dict):
          value = convert_key_to_attr_names(cls, value)
          value = cls(**value)
  
      else:
          value = cls(value)
  
      return value