def get_table_info(conn, tablename):
    """Returns TableInfo object"""
    r = conn.execute("pragma table_info('{}')".format(tablename))
    ret = TableInfo(((row["name"], row) for row in r))
    return ret
Returns TableInfo object