code: def set(self, model, property_name, value):
          
          if type(model) is dict:
              model[property_name] = value
          elif hasattr(model, 'set_' + property_name):
              setter = getattr(model, 'set_' + property_name)
              setter(value)
          else:
              try:
                  setattr(model, property_name, value)
              except AttributeError:
                  pass
docs: Set model property to value. Use setter if possible.
          :param model: model object or dict
          :param property_name: str, name on the model
          :param value: mixed, a value to set
          :return: None