# Buggy code
def ParseOptions(self, options):
    """Parses the options.

    Args:
      options: the command line arguments (instance of argparse.Namespace).

    Raises:
      BadConfigOption: if the options are invalid.
    """
    # Check the list options first otherwise required options will raise.
    self._ParseLanguageOptions(options)
    self._ParseTimezoneOption(options)

    if (
        self.list_analysis_plugins
        or self.list_language_identifiers
        or self.list_output_modules
        or self.list_timezones
    ):
        return

    super(PsortTool, self).ParseOptions(options)
    self._ParseDataLocationOption(options)
    self._ParseAnalysisPluginOptions(options)
    self._ParseFilterOptions(options)

    if self._debug_mode:
        logging_level = logging.DEBUG
    elif self._quiet_mode:
        logging_level = logging.WARNING
    else:
        logging_level = logging.INFO

    log_file = getattr(options, "log_file", None)
    self._ConfigureLogging(log_level=logging_level, filename=log_file)

    self._output_format = getattr(options, "output_format", None)
    if not self._output_format:
        raise errors.BadConfigOption("Missing output format.")
    self._front_end.SetOutputFormat(self._output_format)

    if not self._front_end.HasOutputClass(self._output_format):
        raise errors.BadConfigOption(
            "Unsupported output format: {0:s}.".format(self._output_format)
        )

    self._deduplicate_events = getattr(options, "dedup", True)

    self._output_filename = getattr(options, "write", None)
    if self._output_filename:
        self._front_end.SetOutputFilename(self._output_filename)

    if not self._data_location:
        logging.warning("Unable to automatically determine data location.")

    # TODO: refactor this.
    self._options = options


# Traceback (AttributeError)
PYTHONPATH=. ./tools/psort.py --analysis list

******************************* Analysis Plugins *******************************
Traceback (most recent call last):
File "./tools/psort.py", line 604, in <module>
if not Main():
File "./tools/psort.py", line 581, in Main
tool.ListAnalysisPlugins()
File "./tools/psort.py", line 297, in ListAnalysisPlugins
analysis_plugins = self._front_end.GetAnalysisPlugins()
File "/home/onager/code/plaso/plaso/frontend/psort.py", line 96, in GetAnalysisPlugins
return analysis_manager.AnalysisPluginManager.ListAllPluginNames()
File "/home/onager/code/plaso/plaso/analysis/manager.py", line 55, in ListAllPluginNames
for cls_obj in interface.AnalysisPlugin.classes.itervalues():
AttributeError: type object 'AnalysisPlugin' has no attribute 'classes'

# Fixed code
def ParseOptions(self, options):
    """Parses the options.

    Args:
      options: the command line arguments (instance of argparse.Namespace).

    Raises:
      BadConfigOption: if the options are invalid.
    """
    # Check the list options first otherwise required options will raise.
    self._ParseLanguageOptions(options)
    self._ParseTimezoneOption(options)

    if (
        self.list_analysis_plugins
        or self.list_language_identifiers
        or self.list_output_modules
        or self.list_timezones
    ):
        return

    super(PsortTool, self).ParseOptions(options)
    self._ParseDataLocationOption(options)
    self._ParseAnalysisPluginOptions(options)
    self._ParseFilterOptions(options)

    if self._debug_mode:
        logging_level = logging.DEBUG
    elif self._quiet_mode:
        logging_level = logging.WARNING
    else:
        logging_level = logging.INFO

    log_file = getattr(options, "log_file", None)
    self._ConfigureLogging(log_level=logging_level, filename=log_file)

    self._output_format = getattr(options, "output_format", None)
    if not self._output_format:
        raise errors.BadConfigOption("Missing output format.")
    self._front_end.SetOutputFormat(self._output_format)

    if not self._front_end.HasOutputClass(self._output_format):
        raise errors.BadConfigOption(
            "Unsupported output format: {0:s}.".format(self._output_format)
        )

    self._deduplicate_events = getattr(options, "dedup", True)

    self._output_filename = getattr(options, "write", None)
    if self._output_filename:
        self._front_end.SetOutputFilename(self._output_filename)

    if self._data_location:
        self._front_end.SetDataLocation(self._data_location)
    else:
        logging.warning("Unable to automatically determine data location.")

    # TODO: refactor this.
    self._options = options