code: def emit(self, record):
          
          try:
              message = self.format(record)
  
              if not self.is_colorized:
                  self.stream.write(message)
              else:
                  style = self._get_style_function_for_level(record.levelno)
                  self.stream.write(style(message))
  
              self.stream.write(getattr(self, 'terminator', '\n'))
              self.flush()
  
          except (KeyboardInterrupt, SystemExit):
              raise
          except:
              self.handleError(record)
docs: Emit a record.
  
          If the stream associated with this handler provides tty then the record
          that is emitted with be formatted to include escape sequences for
          appropriate styling.