code: def isatty(self):  # nocover
          
          return (self.redirect is not None and
                  hasattr(self.redirect, 'isatty') and self.redirect.isatty())
docs: Returns true of the redirect is a terminal.
  
          Notes:
              Needed for IPython.embed to work properly when this class is used
              to override stdout / stderr.