def connect(path, mode='rwc'):
    'Returns a sqlite3 connection to a Toron node file.'
    uri_path = _path_to_sqlite_uri(path)
    uri_path = f'{uri_path}?mode={mode}'
    try:
        get_connection = (lambda : sqlite3.connect(database=uri_path, detect_types=sqlite3.PARSE_DECLTYPES, isolation_level=None, uri=True))
        if os.path.exists(path):
            con = get_connection()
        else:
            con = get_connection()
            con.executescript(_schema_script)
    except sqlite3.OperationalError as err:
        msg = str(err).replace('database file', f'node file {path!r}')
        raise ToronError(msg)
    try:
        _add_functions_and_triggers(con)
    except (sqlite3.OperationalError, sqlite3.DatabaseError):
        con.close()
        raise ToronError(f'Path is not a Toron node: {path!r}')
    cur = con.execute("SELECT value FROM property WHERE key='schema_version'")
    (schema_version, *_) = (cur.fetchone() or (None,))
    cur.close()
    if (schema_version != 1):
        msg = f'Unsupported Toron node format: schema version {schema_version!r}'
        raise ToronError(msg)
    return con
Returns a sqlite3 connection to a Toron node file.
def connect(path, mode='rwc'):
    
    uri_path = _path_to_sqlite_uri(path)
    uri_path = f'{uri_path}?mode={mode}'
    try:
        get_connection = (lambda : sqlite3.connect(database=uri_path, detect_types=sqlite3.PARSE_DECLTYPES, isolation_level=None, uri=True))
        if os.path.exists(path):
            con = get_connection()
        else:
            con = get_connection()
            con.executescript(_schema_script)
    except sqlite3.OperationalError as err:
        msg = str(err).replace('database file', f'node file {path!r}')
        raise ToronError(msg)
    try:
        _add_functions_and_triggers(con)
    except (sqlite3.OperationalError, sqlite3.DatabaseError):
        con.close()
        raise ToronError(f'Path is not a Toron node: {path!r}')
    cur = con.execute("SELECT value FROM property WHERE key='schema_version'")
    (schema_version, *_) = (cur.fetchone() or (None,))
    cur.close()
    if (schema_version != 1):
        msg = f'Unsupported Toron node format: schema version {schema_version!r}'
        raise ToronError(msg)
    return con