code: def model_to_dict(instance, fields=None, exclude=None):
      
  
      return {
          field.name: field_to_dict(field, instance)
          for field in chain(instance._meta.concrete_fields, instance._meta.many_to_many)  # pylint: disable=W0212
          if not should_exclude_field(field, fields, exclude)
      }
docs: The same implementation as django model_to_dict but editable fields are allowed