code: def _get_k8s_model_dict(model_type, model):
      
      model = copy.deepcopy(model)
  
      if isinstance(model, model_type):
          return model.to_dict()
      elif isinstance(model, dict):
          return _map_dict_keys_to_model_attributes(model_type, model)
      else:
          raise AttributeError("Expected object of type '{}' (or 'dict') but got '{}'.".format(model_type.__name__, type(model).__name__))
docs: Returns a dictionary representation of a provided model type