def METHOD_NAME(self, record: logging.LogRecord) -> str:
    levelname = record.levelname
    if self.use_color and levelname in self.COLORS:
        levelname_with_color = (
            self.COLOR_SEQ % (30 + self.COLORS[levelname])
            + levelname
            + self.RESET_SEQ
        )
        record.levelname = levelname_with_color
        formated_record = logging.Formatter.METHOD_NAME(self, record)
        record.levelname = (
            levelname  # Resetting levelname as `record` might be used elsewhere
        )
        return formated_record
    else:
        return logging.Formatter.METHOD_NAME(self, record)