code: def _FlushExportBuffer(self, output_module, deduplicate_events=True):
      last_macb_group_identifier = None
      last_content_identifier = None
      macb_group = []
      generator = self._export_event_heap.PopEvents()
      for macb_group_identifier, content_identifier, event in generator:
        if deduplicate_events and last_content_identifier == content_identifier:
          self._events_status.number_of_duplicate_events += 1
          continue
        if macb_group_identifier is None:
          if macb_group:
            output_module.WriteEventMACBGroup(macb_group)
            macb_group = []
          output_module.WriteEvent(event)
        else:
          if (last_macb_group_identifier == macb_group_identifier or
              not macb_group):
            macb_group.append(event)
          else:
            output_module.WriteEventMACBGroup(macb_group)
            macb_group = [event]
          self._events_status.number_of_macb_grouped_events += 1
        last_macb_group_identifier = macb_group_identifier
        last_content_identifier = content_identifier
      if macb_group:
        output_module.WriteEventMACBGroup(macb_group)