<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format(self, record):
 """Format the log record."""

        levelname = getattr(record, 'levelname', None)
        record.levelcolor = ''
        record.endlevelcolor = ''

        if levelname:
            level_color = getattr(self.TermColors, levelname, '')
            record.levelcolor = level_color
            record.endlevelcolor = self.TermColors.ENDC if level_color else ''

        return super(FleakerLogFormatter, self).format(record)