<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def decolorized_write(self, fileobj: IO, msg: str) -> None: """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. """

        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)