def withStderrTo(stderr, f, *args, **kwargs):
    (outer, sys.stderr) = (sys.stderr, stderr)
    try:
        return f(*args, **kwargs)
    finally:
        sys.stderr = outer
Call C{f} with C{sys.stderr} redirected to C{stderr}.
dataset/ETHPy150Open patrys/PythonChecker/pyflakes/test/test_api.py/withStderrTo