'Undo the last redirection (that hasn\'t yet been undone).
If any subprocesses have been launched since the redirection was
performed, they must have ended by the time this is called.  Otherwise,
this will hang waiting for the logging subprocess to end.'

def undo_redirect(self):

    if (not self._context_stack):
        raise RuntimeError('No    redirects    to    undo')
    self._pop_context()
