code: def __prepare_record(self, record, enabled_fields):
          
          message = record.getMessage()
          if hasattr(record, 'prefix'):
              message = "{}{}".format((str(record.prefix) + ' ') if record.prefix else '', message)
  
          obj = {
              'name': record.name,
              'asctime': self.formatTime(record, self.datefmt),
              'created': record.created,
              'msecs': record.msecs,
              'relativeCreated': record.relativeCreated,
              'levelno': record.levelno,
              'levelname': self._level_names[record.levelname],
              'thread': record.thread,
              'threadName': record.threadName,
              'process': record.process,
              'pathname': record.pathname,
              'filename': record.filename,
              'module': record.module,
              'lineno': record.lineno,
              'funcName': record.funcName,
              'message': message,
              'exception': record.exc_info[0].__name__ if record.exc_info else None,
              'stacktrace': record.exc_text,
          }
  
          if not isinstance(enabled_fields, list):
              enabled_fields = [str(enabled_fields)]
  
          ef = {}
          for item in enabled_fields:
              if not isinstance(item, (str, tuple)):
                  continue
              if not isinstance(item, tuple):
                  ef[item] = item
              else:
                  ef[item[0]] = item[1]
  
          result = {}
          for key, val in obj.items():
              if key in ef:
                  result[ef[key]] = val
  
          return result
docs: Prepare log record with given fields.