code: def CompileReport(self, mediator):
      
      # TODO: refactor to update the counter on demand instead of
      # during reporting.
      path_specs_per_labels_counter = collections.Counter()
      tags = []
      while self._ContinueReportCompilation():
        try:
          self._LogProgressUpdateIfReasonable()
          hash_analysis = self.hash_analysis_queue.get(
              timeout=self._analysis_queue_timeout)
        except Queue.Empty:
          # The result queue is empty, but there could still be items that need
          # to be processed by the analyzer.
          continue
        pathspecs, labels, new_tags = self._HandleHashAnalysis(
            hash_analysis)
  
        tags.extend(new_tags)
        for label in labels:
          path_specs_per_labels_counter[label] += len(pathspecs)
  
      self._analyzer.SignalAbort()
  
      lines_of_text = ['{0:s} hash tagging results'.format(self.NAME)]
      for label, count in sorted(path_specs_per_labels_counter.items()):
        line_of_text = (
            '{0:d} path specifications tagged with label: {1:s}'.format(
                count, label))
        lines_of_text.append(line_of_text)
      lines_of_text.append('')
      report_text = '\n'.join(lines_of_text)
  
      for event_tag in tags:
        mediator.ProduceEventTag(event_tag)
  
      return reports.AnalysisReport(
          plugin_name=self.NAME, text=report_text)
docs: Compiles an analysis report.
  
      Args:
        mediator (AnalysisMediator): mediates interactions between
            analysis plugins and other components, such as storage and dfvfs.
  
      Returns:
        AnalysisReport: report.