@contextlib.contextmanager
def print_output():
    try:
        yield
    except __HOLE__ as e:
        if STATUS:
            print(STATUS)
        raise
    except Exception as e:
        logging.exception('The plugin %s has failed with an unhandled '
                          'exception', sys.argv[0])
        status_err(traceback.format_exc(), force_print=True, exception=e)
    else:
        if STATUS:
            print(STATUS)
        for metric in METRICS:
            print(metric)
dataset/ETHPy150Open rcbops/rpc-openstack/maas/plugins/maas_common.py/print_output