code: def get_k8s_model(model_type, model_dict):
      
      model_dict = copy.deepcopy(model_dict)
  
      if isinstance(model_dict, model_type):
          return model_dict
      elif isinstance(model_dict, dict):
          # convert the dictionaries camelCase keys to snake_case keys
          model_dict = _map_dict_keys_to_model_attributes(model_type, model_dict)
          # use the dictionary keys to initialize a model of given type
          return model_type(**model_dict)
      else:
          raise AttributeError("Expected object of type 'dict' (or '{}') but got '{}'.".format(model_type.__name__, type(model_dict).__name__))
docs: Returns an instance of type specified model_type from an model instance or
      represantative dictionary.