def field_to_dict(field, instance):
<EOL>from django.db.models.fields.related import ManyToManyField<EOL>return (many_to_many_field_to_dict(field, instance) if isinstance(field, ManyToManyField)<EOL>else field.value_from_object(instance))<EOL>
Converts a model field to a dictionary