code: def ParseRecord(self, parser_mediator, key, structure):
      
      if key not in ('header', 'header_signature', 'logline'):
        raise errors.ParseError(
            'Unable to parse record, unknown structure: {0:s}'.format(key))
  
      if key == 'logline':
        self._ParseLogLine(parser_mediator, structure)
  
      elif key == 'header':
        self._ParseHeader(parser_mediator, structure)
  
      elif key == 'header_signature':
        # If this key is matched (after others keys failed) we got a different
        # localized header and we should stop parsing until a new good header
        # is found. Stop parsing is done setting xchat_year to 0.
        # Note that the code assumes that LINE_STRUCTURES will be used in the
        # exact order as defined!
        logger.warning('Unknown locale header.')
        self._xchat_year = 0
docs: Parses a log record structure and produces events.
  
      Args:
        parser_mediator (ParserMediator): mediates interactions between parsers
            and other components, such as storage and dfvfs.
        key (str): identifier of the structure of tokens.
        structure (pyparsing.ParseResults): structure of tokens derived from
            a line of a text file.
  
      Raises:
        ParseError: when the structure type is unknown.