in annotation/annotation/database.py [0:0]
def todict(obj):
"""Return the object's dict excluding private attributes,
sqlalchemy state and relationship attributes.
"""
excl = ("_sa_adapter", "_sa_instance_state")
return {
k: v
for k, v in vars(obj).items()
if not k.startswith("_") and not any(hasattr(v, a) for a in excl)
}