@contextlib.contextmanager<EOL>def quiet():
old_stdout = sys.stdout<EOL>old_stderr = sys.stderr<EOL>new_stdout = sys.stdout = StringIO()<EOL>new_stderr = sys.stderr = StringIO()<EOL>try:<EOL><INDENT>yield new_stdout, new_stderr<EOL><DEDENT>finally:<EOL><INDENT>new_stdout.seek(<NUM_LIT:0>)<EOL>new_stderr.seek(<NUM_LIT:0>)<EOL>sys.stdout = old_stdout<EOL>sys.stderr = old_stderr<EOL><DEDENT>
Redirect stdout/stderr to StringIO objects to prevent console output from
distutils commands.