# Buggy code
def _FormatStatusTableRow(self, process_status):
    """Formats a status table row.

    Args:
      process_status (ProcessStatus): processing status.
    """
    # This check makes sure the columns are tab aligned.
    identifier = process_status.identifier
    if len(identifier) < 8:
        identifier = "{0:s}\t\t".format(identifier)
    elif len(identifier) < 16:
        identifier = "{0:s}\t".format(identifier)

    status = process_status.status
    if len(status) < 8:
        status = "{0:s}\t".format(status)

    events = ""
    if (
        process_status.number_of_consumed_events is not None
        and process_status.number_of_consumed_events_delta is not None
    ):
        events = "{0:d} ({1:d})".format(
            process_status.number_of_consumed_events,
            process_status.number_of_consumed_events_delta,
        )

    # This check makes sure the columns are tab aligned.
    if len(events) < 8:
        events = "{0:s}\t".format(events)

    reports = ""
    if (
        process_status.number_of_produced_reports is not None
        and process_status.number_of_produced_reports_delta is not None
    ):
        reports = "{0:d} ({1:d})".format(
            process_status.number_of_produced_reports,
            process_status.number_of_produced_reports_delta,
        )

    # This check makes sure the columns are tab aligned.
    if len(reports) < 8:
        reports = "{0:s}\t".format(reports)

    # TODO: shorten display name to fit in 80 chars and show the filename.
    return "{0:s}\t{1:d}\t{2:s}\t{3:s}\t{4:s}".format(
        identifier, process_status.pid, status, events, reports
    )


# Traceback (KeyError)
[ERROR] (nsrlsvr   ) PID:XXXXX <analysis_process> <dfvfs.path.os_path_spec.OSPathSpec object at 0xXXXXXXXXXXXX>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/analysis_process.py", line 138, in _Main
self._analysis_mediator.ProduceAnalysisReport(self._analysis_plugin)
File "/usr/lib/python2.7/dist-packages/plaso/analysis/mediator.py", line 95, in ProduceAnalysisReport
analysis_report = plugin.CompileReport(self)
File "/usr/lib/python2.7/dist-packages/plaso/analysis/interface.py", line 280, in CompileReport
hash_analysis)
File "/usr/lib/python2.7/dist-packages/plaso/analysis/interface.py", line 187, in _HandleHashAnalysis
event_uuids = self._event_uuids_by_pathspec.pop(pathspec)
KeyError: <dfvfs.path.os_path_spec.OSPathSpec object at 0xXXXXXXXXXXXX>

# Fixed code
def _FormatStatusTableRow(self, process_status):
    """Formats a status table row.

    Args:
      process_status (ProcessStatus): processing status.
    """
    # This check makes sure the columns are tab aligned.
    identifier = process_status.identifier
    if len(identifier) < 8:
        identifier = "{0:s}\t\t".format(identifier)
    elif len(identifier) < 16:
        identifier = "{0:s}\t".format(identifier)

    status = process_status.status
    if len(status) < 8:
        status = "{0:s}\t".format(status)

    events = ""
    if (
        process_status.number_of_consumed_events is not None
        and process_status.number_of_consumed_events_delta is not None
    ):
        events = "{0:d} ({1:d})".format(
            process_status.number_of_consumed_events,
            process_status.number_of_consumed_events_delta,
        )

    # This check makes sure the columns are tab aligned.
    if len(events) < 8:
        events = "{0:s}\t".format(events)

    event_tags = ""
    if (
        process_status.number_of_produced_event_tags is not None
        and process_status.number_of_produced_event_tags_delta is not None
    ):
        event_tags = "{0:d} ({1:d})".format(
            process_status.number_of_produced_event_tags,
            process_status.number_of_produced_event_tags_delta,
        )

    # This check makes sure the columns are tab aligned.
    if len(event_tags) < 8:
        event_tags = "{0:s}\t".format(event_tags)

    reports = ""
    if (
        process_status.number_of_produced_reports is not None
        and process_status.number_of_produced_reports_delta is not None
    ):
        reports = "{0:d} ({1:d})".format(
            process_status.number_of_produced_reports,
            process_status.number_of_produced_reports_delta,
        )

    # This check makes sure the columns are tab aligned.
    if len(reports) < 8:
        reports = "{0:s}\t".format(reports)

    # TODO: shorten display name to fit in 80 chars and show the filename.
    return "{0:s}\t{1:d}\t{2:s}\t{3:s}\t{4:s}\t{5:s}".format(
        identifier, process_status.pid, status, events, event_tags, reports
    )