# Buggy code
def _GetStatus(self):
    """Returns status information.

    Returns:
      dict[str, object]: status attributes, indexed by name.
    """
    if self._parser_mediator:
        number_of_produced_errors = self._parser_mediator.number_of_produced_errors
        number_of_produced_events = self._parser_mediator.number_of_produced_events
        number_of_produced_sources = (
            self._parser_mediator.number_of_produced_event_sources
        )
    else:
        number_of_produced_errors = None
        number_of_produced_events = None
        number_of_produced_sources = None

    if self._extraction_worker:
        last_activity_timestamp = self._extraction_worker.last_activity_timestamp
        processing_status = self._extraction_worker.processing_status
    else:
        last_activity_timestamp = 0.0
        processing_status = self._status

    task_identifier = getattr(self._task, "identifier", "")

    status = {
        "display_name": self._current_display_name,
        "identifier": self._name,
        "number_of_consumed_errors": None,
        "number_of_consumed_events": self._number_of_consumed_events,
        "number_of_consumed_sources": self._number_of_consumed_sources,
        "number_of_produced_errors": number_of_produced_errors,
        "number_of_produced_events": number_of_produced_events,
        "number_of_produced_sources": number_of_produced_sources,
        "last_activity_timestamp": last_activity_timestamp,
        "processing_status": processing_status,
        "task_identifier": task_identifier,
    }

    return status


# 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 _GetStatus(self):
    """Returns status information.

    Returns:
      dict[str, object]: status attributes, indexed by name.
    """
    if self._parser_mediator:
        number_of_produced_errors = self._parser_mediator.number_of_produced_errors
        number_of_produced_events = self._parser_mediator.number_of_produced_events
        number_of_produced_sources = (
            self._parser_mediator.number_of_produced_event_sources
        )
    else:
        number_of_produced_errors = None
        number_of_produced_events = None
        number_of_produced_sources = None

    if self._extraction_worker:
        last_activity_timestamp = self._extraction_worker.last_activity_timestamp
        processing_status = self._extraction_worker.processing_status
    else:
        last_activity_timestamp = 0.0
        processing_status = self._status

    task_identifier = getattr(self._task, "identifier", "")

    status = {
        "display_name": self._current_display_name,
        "identifier": self._name,
        "number_of_consumed_errors": None,
        "number_of_consumed_event_tags": None,
        "number_of_consumed_events": self._number_of_consumed_events,
        "number_of_consumed_sources": self._number_of_consumed_sources,
        "number_of_produced_errors": number_of_produced_errors,
        "number_of_produced_event_tags": None,
        "number_of_produced_events": number_of_produced_events,
        "number_of_produced_sources": number_of_produced_sources,
        "last_activity_timestamp": last_activity_timestamp,
        "processing_status": processing_status,
        "task_identifier": task_identifier,
    }

    return status