def object_as_dict(obj):
return {c.key: getattr(obj, c.key)<EOL>for c in inspect(obj).mapper.column_attrs}<EOL>
Turn an SQLAlchemy model into a dict of field names and values.

    Based on https://stackoverflow.com/a/37350445/1579058