def dev_null_wrapper(func, *a, **kwargs):
    """
    Temporarily swap stdout with /dev/null, and execute given function while stdout goes to /dev/null.
    This is useful because netsnmp writes to stdout and disturbes Icinga result in some cases.
    """
    os.dup2(dev_null, sys.stdout.fileno())
    return_object = func(*a, **kwargs)
    sys.stdout.flush()
    os.dup2(tmp_stdout, sys.stdout.fileno())
    return return_object
Temporarily swap stdout with /dev/null, and execute given function while stdout goes to /dev/null.
    This is useful because netsnmp writes to stdout and disturbes Icinga result in some cases.