nodes: 0, module; 1, function_definition; 2, function_name:_MergeEventTag; 3, parameters; 4, block; 5, identifier:self; 6, identifier:storage_writer; 7, identifier:attribute_container; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, comment:# Check if the event has already been tagged on a previous occasion,; 13, comment:# we need to append the event tag to the last stored one.; 14, expression_statement; 15, if_statement; 16, expression_statement; 17, comment:"""Merges an event tag with the last stored event tag.
  
      If there is an existing event the provided event tag is updated with
      the contents of the existing one. After which the event tag index is
      updated.
  
      Args:
        storage_writer (StorageWriter): storage writer.
        attribute_container (AttributeContainer): container.
      """; 18, comparison_operator:attribute_container.CONTAINER_TYPE != 'event_tag'; 19, block; 20, assignment; 21, not_operator; 22, block; 23, assignment; 24, identifier:stored_event_tag; 25, block; 26, call; 27, attribute; 28, string; 29, return_statement; 30, identifier:event_identifier; 31, call; 32, identifier:event_identifier; 33, return_statement; 34, identifier:stored_event_tag; 35, call; 36, expression_statement; 37, expression_statement; 38, attribute; 39, argument_list; 40, identifier:attribute_container; 41, identifier:CONTAINER_TYPE; 42, string_content:event_tag; 43, attribute; 44, argument_list; 45, attribute; 46, argument_list; 47, call; 48, call; 49, attribute; 50, identifier:SetEventTag; 51, identifier:attribute_container; 52, identifier:attribute_container; 53, identifier:GetEventIdentifier; 54, attribute; 55, identifier:GetEventTagByIdentifier; 56, identifier:storage_writer; 57, identifier:event_identifier; 58, attribute; 59, argument_list; 60, attribute; 61, argument_list; 62, identifier:self; 63, identifier:_event_tag_index; 64, identifier:self; 65, identifier:_event_tag_index; 66, identifier:attribute_container; 67, identifier:AddComment; 68, attribute; 69, identifier:attribute_container; 70, identifier:AddLabels; 71, attribute; 72, identifier:stored_event_tag; 73, identifier:comment; 74, identifier:stored_event_tag; 75, identifier:labels
code: def _MergeEventTag(self, storage_writer, attribute_container):
      """Merges an event tag with the last stored event tag.
  
      If there is an existing event the provided event tag is updated with
      the contents of the existing one. After which the event tag index is
      updated.
  
      Args:
        storage_writer (StorageWriter): storage writer.
        attribute_container (AttributeContainer): container.
      """
      if attribute_container.CONTAINER_TYPE != 'event_tag':
        return
  
      event_identifier = attribute_container.GetEventIdentifier()
      if not event_identifier:
        return
  
      # Check if the event has already been tagged on a previous occasion,
      # we need to append the event tag to the last stored one.
      stored_event_tag = self._event_tag_index.GetEventTagByIdentifier(
          storage_writer, event_identifier)
      if stored_event_tag:
        attribute_container.AddComment(stored_event_tag.comment)
        attribute_container.AddLabels(stored_event_tag.labels)
  
      self._event_tag_index.SetEventTag(attribute_container)