# Buggy code
def _PromptUserForVSSStoreIdentifiers(
    self, volume_system, volume_identifiers, vss_stores=None
):
    """Prompts the user to provide the VSS store identifiers.

    This method first checks for the preferred VSS stores and falls back
    to prompt the user if no usable preferences were specified.

    Args:
      volume_system: The volume system (instance of dfvfs.VShadowVolumeSystem).
      volume_identifiers: List of allowed volume identifiers.
      vss_stores: Optional list of preferred VSS store identifiers. The
                  default is None.

    Returns:
      The list of selected VSS store identifiers.

    Raises:
      SourceScannerError: if the source cannot be processed.
    """
    normalized_volume_identifiers = []
    for volume_identifier in volume_identifiers:
        volume = volume_system.GetVolumeByIdentifier(volume_identifier)
        if not volume:
            raise errors.SourceScannerError(
                "Volume missing for identifier: {0:s}.".format(volume_identifier)
            )

        try:
            volume_identifier = int(volume.identifier[3:], 10)
            normalized_volume_identifiers.append(volume_identifier)
        except ValueError:
            pass

    # TODO: refactor this to _GetVSSStoreIdentifiers.
    if vss_stores:
        if vss_stores == ["all"]:
            # We need to set the stores to cover all vss stores.
            vss_stores = range(1, volume_system.number_of_volumes + 1)

        if not set(vss_stores).difference(normalized_volume_identifiers):
            return vss_stores

    print_header = True
    while True:
        if print_header:
            self._output_writer.Write(
                "The following Volume Shadow Snapshots (VSS) were found:\n"
                "Identifier\tVSS store identifier\t\t\tCreation Time\n"
            )

            for volume_identifier in volume_identifiers:
                volume = volume_system.GetVolumeByIdentifier(volume_identifier)
                if not volume:
                    raise errors.SourceScannerError(
                        "Volume missing for identifier: {0:s}.".format(
                            volume_identifier
                        )
                    )

                vss_identifier = volume.GetAttribute("identifier")
                vss_creation_time = volume.GetAttribute("creation_time")
                vss_creation_time = timelib.Timestamp.FromFiletime(
                    vss_creation_time.value
                )
                vss_creation_time = timelib.Timestamp.CopyToIsoFormat(vss_creation_time)
                self._output_writer.Write(
                    "{0:s}\t\t{1:s}\t{2:s}\n".format(
                        volume.identifier, vss_identifier.value, vss_creation_time
                    )
                )

            self._output_writer.Write("\n")

            print_header = False

        self._output_writer.Write(
            "Please specify the identifier(s) of the VSS that should be "
            "processed:\nNote that a range of stores can be defined as: 3..5. "
            "Multiple stores can\nbe defined as: 1,3,5 (a list of comma "
            "separated values). Ranges and lists can\nalso be combined "
            "as: 1,3..5. The first store is 1. All stores can be defined\n"
            'as "all". If no stores are specified none will be processed. You\n'
            "can abort with Ctrl^C.\n"
        )

        selected_vss_stores = self._input_reader.Read()

        selected_vss_stores = selected_vss_stores.strip()
        if not selected_vss_stores:
            break

        try:
            selected_vss_stores = self._ParseVSSStoresString(selected_vss_stores)
        except errors.BadConfigOption:
            selected_vss_stores = []

        if selected_vss_stores == ["all"]:
            # We need to set the stores to cover all vss stores.
            selected_vss_stores = range(1, volume_system.number_of_volumes + 1)

        if not set(selected_vss_stores).difference(normalized_volume_identifiers):
            break

        self._output_writer.Write(
            "\n"
            "Unsupported VSS identifier(s), please try again or abort with "
            "Ctrl^C.\n"
            "\n"
        )

    return selected_vss_stores


# Traceback (AttributeError)
The following Volume Shadow Snapshots (VSS) were found:
Identifier  VSS store identifier            Creation Time
vss1        6101d464-812d-11e3-9952-40f02f0e6321    2014-01-19T17:45:46.579218+00:00

Please specify the identifier(s) of the VSS that should be processed:
Note that a range of stores can be defined as: 3..5. Multiple stores can
be defined as: 1,3,5 (a list of comma separated values). Ranges and lists can
also be combined as: 1,3..5. The first store is 1. All stores can be defined
as "all". If no stores are specified none will be processed. You
can abort with Ctrl^C.

Traceback (most recent call last):
File "/usr/local/bin/log2timeline.py", line 5, in <module>
pkg_resources.run_script('plaso==1.3.0-20150715', u'log2timeline.py')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/log2timeline.py", line 676, in <module>
if not Main():
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/log2timeline.py", line 662, in Main
tool.ProcessSources()
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/log2timeline.py", line 558, in ProcessSources
scan_context = self.ScanSource()
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/plaso/cli/storage_media_tool.py", line 974, in ScanSource
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/plaso/cli/storage_media_tool.py", line 659, in _ScanVolume
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/plaso/cli/storage_media_tool.py", line 694, in _ScanVolumeScanNode
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.0_20150715-py2.7.egg/plaso/cli/storage_media_tool.py", line 763, in _ScanVolumeScanNodeVSS
AttributeError: 'unicode' object has no attribute 'reverse'

# Fixed code
def _PromptUserForVSSStoreIdentifiers(
    self, volume_system, volume_identifiers, vss_stores=None
):
    """Prompts the user to provide the VSS store identifiers.

    This method first checks for the preferred VSS stores and falls back
    to prompt the user if no usable preferences were specified.

    Args:
      volume_system: The volume system (instance of dfvfs.VShadowVolumeSystem).
      volume_identifiers: List of allowed volume identifiers.
      vss_stores: Optional list of preferred VSS store identifiers. The
                  default is None.

    Returns:
      The list of selected VSS store identifiers.

    Raises:
      SourceScannerError: if the source cannot be processed.
    """
    normalized_volume_identifiers = []
    for volume_identifier in volume_identifiers:
        volume = volume_system.GetVolumeByIdentifier(volume_identifier)
        if not volume:
            raise errors.SourceScannerError(
                "Volume missing for identifier: {0:s}.".format(volume_identifier)
            )

        try:
            volume_identifier = int(volume.identifier[3:], 10)
            normalized_volume_identifiers.append(volume_identifier)
        except ValueError:
            pass

    # TODO: refactor this to _GetVSSStoreIdentifiers.
    if vss_stores:
        if vss_stores == ["all"]:
            # We need to set the stores to cover all vss stores.
            vss_stores = range(1, volume_system.number_of_volumes + 1)

        if not set(vss_stores).difference(normalized_volume_identifiers):
            return vss_stores

    print_header = True
    while True:
        if print_header:
            self._output_writer.Write(
                "The following Volume Shadow Snapshots (VSS) were found:\n"
                "Identifier\tVSS store identifier\t\t\tCreation Time\n"
            )

            for volume_identifier in volume_identifiers:
                volume = volume_system.GetVolumeByIdentifier(volume_identifier)
                if not volume:
                    raise errors.SourceScannerError(
                        "Volume missing for identifier: {0:s}.".format(
                            volume_identifier
                        )
                    )

                vss_identifier = volume.GetAttribute("identifier")
                vss_creation_time = volume.GetAttribute("creation_time")
                vss_creation_time = timelib.Timestamp.FromFiletime(
                    vss_creation_time.value
                )
                vss_creation_time = timelib.Timestamp.CopyToIsoFormat(vss_creation_time)
                self._output_writer.Write(
                    "{0:s}\t\t{1:s}\t{2:s}\n".format(
                        volume.identifier, vss_identifier.value, vss_creation_time
                    )
                )

            self._output_writer.Write("\n")

            print_header = False

        self._output_writer.Write(
            "Please specify the identifier(s) of the VSS that should be "
            "processed:\nNote that a range of stores can be defined as: 3..5. "
            "Multiple stores can\nbe defined as: 1,3,5 (a list of comma "
            "separated values). Ranges and lists can\nalso be combined "
            "as: 1,3..5. The first store is 1. All stores can be defined\n"
            'as "all". If no stores are specified none will be processed. You\n'
            "can abort with Ctrl^C.\n"
        )

        selected_vss_stores = self._input_reader.Read()

        selected_vss_stores = selected_vss_stores.strip()
        if not selected_vss_stores:
            return []

        try:
            selected_vss_stores = self._ParseVSSStoresString(selected_vss_stores)
        except errors.BadConfigOption:
            selected_vss_stores = []

        if selected_vss_stores == ["all"]:
            # We need to set the stores to cover all vss stores.
            selected_vss_stores = range(1, volume_system.number_of_volumes + 1)

        if not set(selected_vss_stores).difference(normalized_volume_identifiers):
            break

        self._output_writer.Write(
            "\n"
            "Unsupported VSS identifier(s), please try again or abort with "
            "Ctrl^C.\n"
            "\n"
        )

    return selected_vss_stores