# Buggy code
def AddArguments(cls, argument_group):
    """Adds command line arguments the helper supports to an argument group.

    This function takes an argument parser or an argument group object and adds
    to it all the command line arguments this helper supports.

    Args:
      argument_group (argparse._ArgumentGroup|argparse.ArgumentParser):
          argparse group.
    """
    argument_group.add_argument(
        "--virustotal-api-key",
        dest="virustotal_api_key",
        type=str,
        action="store",
        default=None,
        help="Specify the API key for use with VirusTotal.",
    )
    argument_group.add_argument(
        "--virustotal-free-rate-limit",
        dest="virustotal_rate_limit",
        action="store_false",
        default=cls._DEFAULT_RATE_LIMIT,
        help=(
            "Limit Virustotal requests to the default free API key rate of "
            "4 requests per minute. Set this to false if you have an key "
            "for the private API."
        ),
    )


# 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 AddArguments(cls, argument_group):
    """Adds command line arguments the helper supports to an argument group.

    This function takes an argument parser or an argument group object and adds
    to it all the command line arguments this helper supports.

    Args:
      argument_group (argparse._ArgumentGroup|argparse.ArgumentParser):
          argparse group.
    """
    argument_group.add_argument(
        "--virustotal-api-key",
        "--virustotal_api_key",
        dest="virustotal_api_key",
        type=str,
        action="store",
        default=None,
        metavar="API_KEY",
        help=("Specify the API key for use with VirusTotal."),
    )

    argument_group.add_argument(
        "--virustotal-free-rate-limit",
        "--virustotal_free_rate_limit",
        dest="virustotal_free_rate_limit",
        action="store_false",
        default=cls._DEFAULT_RATE_LIMIT,
        help=(
            "Limit Virustotal requests to the default free API key rate of "
            "4 requests per minute. Set this to false if you have an key "
            "for the private API."
        ),
    )

    argument_group.add_argument(
        "--virustotal-hash",
        "--virustotal_hash",
        dest="virustotal_hash",
        type=str,
        action="store",
        choices=["md5", "sha1", "sha256"],
        default=cls._DEFAULT_HASH,
        metavar="HASH",
        help=(
            "Type of hash to query VirusTotal, the default is: {0:s}".format(
                cls._DEFAULT_HASH
            )
        ),
    )