code: def model_to_dict(model, exclude=None):
      
      exclude = exclude or []
      exclude.append('_sa_instance_state')
      return {k: v for k, v in model.__dict__.items() if k not in exclude}
docs: Extract a SQLAlchemy model instance to a dictionary
      :param model: the model to be extracted
      :param exclude: Any keys to be excluded
      :return: New dictionary consisting of property-values