def db_get_idents(conn):
    """
    Returns the idents table as dict of dicts (the ids in the first dimension are always
    smaller than those of the second.
    Args:
        conn: Sqlite3 connection object.

    Returns:
        Idents table as dictionary.
    """
    cur = conn.cursor()
    result = {}
    for id_i, id_j, ident in cur.execute('SELECT id_i, id_j, ident from idents'):
        result.setdefault(id_i, {})[id_j] = ident
    return result