

def start(services=(), io=None):
    'Start an event loop.  If services are given, start them before\n    starting the loop and stop them before stopping the loop.'
    io = (io or loop())
    for svc in services:
        svc.start()
    try:
        normal = True
        io.start()
    except KeyboardInterrupt:
        logging.info('Received keyboard interrupt.')
    except Exception:
        normal = False
    logging.info('Shutting down services.')
    for svc in services:
        try:
            svc.stop()
        except:
            logging.exception(('Error while shutting down %r.' % svc))
    if normal:
        logging.info('Shutting down event loop.')
        io.stop()
    else:
        logging.exception('Uncaught exception')
        raise

dataset/ETHPy150Open HenryHu/pybbs/xmpp/aio.py start/original