@contextmanager
def catch_stdout():
    old_out = sys.stdout
    out = six.StringIO()
    sys.stdout = out

    yield out

    sys.stdout = old_out
Context manager that catch stdout and return StringIO instance.
dataset/ETHPy150Open itdxer/neupy/tests/utils.py/catch_stdout