code: def colored_formatter(record):
      
  
      colours = {'info': ('blue', 'normal'),
                 'debug': ('magenta', 'normal'),
                 'warning': ('yellow', 'normal'),
                 'print': ('green', 'normal'),
                 'error': ('red', 'bold')}
  
      levelname = record.levelname.lower()
  
      if levelname == 'error':
          return
  
      if levelname.lower() in colours:
          levelname_color = colours[levelname][0]
          header = color_text('[{}]: '.format(levelname.upper()), levelname_color)
  
      message = '{0}'.format(record.msg)
  
      warning_category = re.match(r'^(\w+Warning:).*', message)
      if warning_category is not None:
          warning_category_colour = color_text(warning_category.groups()[0], 'cyan')
          message = message.replace(warning_category.groups()[0], warning_category_colour)
  
      sub_level = re.match(r'(\[.+\]:)(.*)', message)
      if sub_level is not None:
          sub_level_name = color_text(sub_level.groups()[0], 'red')
          message = '{}{}'.format(sub_level_name, ''.join(sub_level.groups()[1:]))
  
      # if len(message) > 79:
      #     tw = TextWrapper()
      #     tw.width = 79
      #     tw.subsequent_indent = ' ' * (len(record.levelname) + 2)
      #     tw.break_on_hyphens = False
      #     message = '\n'.join(tw.wrap(message))
  
      sys.__stdout__.write('{}{}\n'.format(header, message))
      sys.__stdout__.flush()
  
      return
docs: Prints log messages with colours.