code: def decolorized_write(self, fileobj: IO, msg: str) -> None:
          
          if self.colors.lower() == constants.COLORS_NEVER.lower() or \
                  (self.colors.lower() == constants.COLORS_TERMINAL.lower() and not fileobj.isatty()):
              msg = utils.strip_ansi(msg)
          fileobj.write(msg)
docs: Write a string to a fileobject, stripping ANSI escape sequences if necessary
  
          Honor the current colors setting, which requires us to check whether the
          fileobject is a tty.