def mexsession(config): "Create a BQApi BQSession object based on config" host = config.get ( 'host.root') user = config.get ( 'host.user') passwd = config.get ( 'host.password') bq = BQSession() bq.config = config bq.init_local (user, passwd, bisque_root = host, create_mex = True) yield bq bq.close()