code: def merge_record_extra(record, target, reserved):
      
      for key, value in record.__dict__.items():
          # this allows to have numeric keys
          if (key not in reserved
              and not (hasattr(key, "startswith")
                       and key.startswith('_'))):
              target[key] = value
      return target
docs: Merges extra attributes from LogRecord object into target dictionary
  
      :param record: logging.LogRecord
      :param target: dict to update
      :param reserved: dict or list with reserved keys to skip