def end_workunit(self, workunit):
    """Implementation of Reporter callback."""
    if not self.is_under_main_root(workunit):
      return

    if workunit.outcome() != WorkUnit.SUCCESS and not self._show_output(workunit):
      # Emit the suppressed workunit output, if any, to aid in debugging the problem.
      if self._get_label_format(workunit) != LabelFormat.FULL:
        self._emit_indented_workunit_label(workunit)
      for name, outbuf in workunit.outputs().items():
        self.emit(self._prefix(workunit, '\n==== {} ====\n'.format(name)))
        self.emit(self._prefix(workunit, outbuf.read_from(0).decode('utf-8')))
        self.flush()
Implementation of Reporter callback.