import sqlite3


def dict_from_row(row):
    """Transforms an sqlite3.Row object to a dictionary"""
    if type(row)==sqlite3.Row :
        return dict(zip(row.keys(), row))
    else :
        return [dict(zip(r.keys(), r)) for r in row]