<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load(dbname):
 """Load an existing SQLite database. Return a Database instance. """

    db = Database(dbname)

    # Get the name of the objects
    tables = get_table_list(db.cur)

    # Create a Trace instance for each object
    chains = 0
    for name in tables:
        db._traces[name] = Trace(name=name, db=db)
        db._traces[name]._shape = get_shape(db.cur, name)
        setattr(db, name, db._traces[name])
        db.cur.execute('SELECT MAX(trace) FROM [%s]' % name)
        chains = max(chains, db.cur.fetchall()[0][0] + 1)

    db.chains = chains
    db.trace_names = chains * [tables, ]
    db._state_ = {}
    return db