def __enter__(self):
        """Change the stream value."""
        self._old_targets.append(getattr(sys, self._stream))
        setattr(sys, self._stream, self._new_target)
        return self._new_target
def __enter__ ( self ) : self . _old_targets . append ( getattr ( sys , self . _stream ) ) setattr ( sys , self . _stream , self . _new_target ) return self . _new_target
Change the stream value.