def connect (db, name):
    """Create a MBus and populate module environment with it's global methods.

    The common case is that we connect to only one message bus. To avoid passing
    around a message bus object we can instead simply do:

    import mbus

    mbus.connect(db, 'client')
    mbus.send('*', 'ping')
    for rowid, source, tag, data in mbus.recv(tag='pong'):
        pass
    """
    g = globals()
    m = MBus(db, name)
    g['send'] = m.send
    g['recv'] = m.recv
Create a MBus and populate module environment with it's global methods.

    The common case is that we connect to only one message bus. To avoid passing
    around a message bus object we can instead simply do:

    import mbus

    mbus.connect(db, 'client')
    mbus.send('*', 'ping')
    for rowid, source, tag, data in mbus.recv(tag='pong'):
        pass
    
recipes/Python/577001_sqlite_message_bus/recipe-577001.py