def format(self, record):
record = ColoredRecord(record)<EOL>record.log_color = self.color(self.log_colors, record.levelname)<EOL>if self.secondary_log_colors:<EOL><INDENT>for name, log_colors in list(self.secondary_log_colors.items()):<EOL><INDENT>color = self.color(log_colors, record.levelname)<EOL>setattr(record, name + '<STR_LIT>', color)<EOL><DEDENT><DEDENT>if sys.version_info > (<NUM_LIT:2>, <NUM_LIT:7>):<EOL><INDENT>message = super(ColoredFormatter, self).format(record)<EOL><DEDENT>else:<EOL><INDENT>message = logging.Formatter.format(self, record)<EOL><DEDENT>if self.reset and not message.endswith(escape_codes['<STR_LIT>']):<EOL><INDENT>message += escape_codes['<STR_LIT>']<EOL><DEDENT>return message<EOL>
Format a message from a record object.