Similar to redirect_stdout() but redirecting sys.stderr to another file or file-like object.
contextlib.redirect_stderr(new_target)