def row2dict(row):
    """Converts a flask-sqlalchemy db row object into a plain python dictionary
    Args:
        row (BaseModel): The db row object
    """
    d = {}
    for column in row.__table__.columns:
        attribute = getattr(row, column.name)
        if attribute is not None:
            d[column.name] = attribute

    return d