# Buggy code
def _ProcessFileEntryDataStream(self, mediator, file_entry, data_stream):
    """Processes a specific data stream of a file entry.

    Args:
      mediator (ParserMediator): mediates the interactions between
          parsers and other components, such as storage and abort signals.
      file_entry (dfvfs.FileEntry): file entry containing the data stream.
      data_stream (dfvfs.DataStream): data stream or None if the file entry
          has no data stream.
    """
    display_name = mediator.GetDisplayName()
    data_stream_name = getattr(data_stream, "name", "") or ""
    logging.debug(
        (
            '[ProcessFileEntryDataStream] processing data stream: "{0:s}" of '
            "file entry: {1:s}"
        ).format(data_stream_name, display_name)
    )

    mediator.ClearEventAttributes()

    if data_stream and self._analyzers:
        # Since AnalyzeDataStream generates event attributes it needs to be
        # called before producing events.
        self._AnalyzeDataStream(mediator, file_entry, data_stream.name)

    self._ExtractMetadataFromFileEntry(mediator, file_entry, data_stream)

    # Not every file entry has a data stream. In such cases we want to
    # extract the metadata only.
    if not data_stream:
        return

    # Determine if the content of the file entry should not be extracted.
    skip_content_extraction = self._CanSkipContentExtraction(file_entry)
    if skip_content_extraction:
        display_name = mediator.GetDisplayName()
        logging.debug("Skipping content extraction of: {0:s}".format(display_name))
        self.processing_status = definitions.PROCESSING_STATUS_IDLE
        return

    path_spec = copy.deepcopy(file_entry.path_spec)
    if data_stream:
        path_spec.data_stream = data_stream.name

    archive_types = []
    compressed_stream_types = []

    if self._process_compressed_streams:
        compressed_stream_types = self._GetCompressedStreamTypes(mediator, path_spec)

    if not compressed_stream_types:
        archive_types = self._GetArchiveTypes(mediator, path_spec)

    if archive_types:
        if self._process_archives:
            self._ProcessArchiveTypes(mediator, path_spec, archive_types)

        if dfvfs_definitions.TYPE_INDICATOR_ZIP in archive_types:
            # ZIP files are the base of certain file formats like docx.
            self._ExtractContentFromDataStream(mediator, file_entry, data_stream.name)

    elif compressed_stream_types:
        self._ProcessCompressedStreamTypes(mediator, path_spec, compressed_stream_types)

    else:
        self._ExtractContentFromDataStream(mediator, file_entry, data_stream.name)


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/bin/log2timeline.py", line 68, in <module>
if not Main():
File "/usr/bin/log2timeline.py", line 54, in Main
tool.ExtractEventsFromSources()
File "/usr/lib/python2.7/dist-packages/plaso/cli/log2timeline_tool.py", line 481, in ExtractEventsFromSources
worker_memory_limit=self._worker_memory_limit)
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/task_engine.py", line 827, in ProcessSources
filter_find_specs=filter_find_specs)
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/task_engine.py", line 323, in _ProcessSources
self._ScheduleTasks(storage_writer)
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/task_engine.py", line 425, in _ScheduleTasks
self._MergeTaskStorage(storage_writer)
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/task_engine.py", line 242, in _MergeTaskStorage
maximum_number_of_containers=self._MAXIMUM_NUMBER_OF_CONTAINERS)
File "/usr/lib/python2.7/dist-packages/plaso/storage/sqlite_file.py", line 1137, in MergeAttributeContainers
self._active_container_type, serialized_data)
File "/usr/lib/python2.7/dist-packages/plaso/storage/interface.py", line 540, in _DeserializeAttributeContainer
attribute_container = self._serializer.ReadSerialized(serialized_data)
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 390, in ReadSerialized
return cls.ReadSerializedDict(json_dict)
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 407, in ReadSerializedDict
json_object = cls._ConvertDictToObject(json_dict)
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 235, in _ConvertDictToObject
attribute_value = cls._ConvertDictToObject(attribute_value)
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 208, in _ConvertDictToObject
return cls._ConvertDictToPathSpec(json_dict)
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 323, in _ConvertDictToPathSpec
json_dict['parent'] = cls._ConvertDictToPathSpec(json_dict['parent'])
File "/usr/lib/python2.7/dist-packages/plaso/serializer/json_serializer.py", line 329, in _ConvertDictToPathSpec
type_indicator, **json_dict)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/factory.py", line 116, in NewPathSpec
return path_spec_type(**kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/os_path_spec.py", line 45, in __init__
super(OSPathSpec, self).__init__(location=location, parent=parent, **kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/location_path_spec.py", line 29, in __init__
super(LocationPathSpec, self).__init__(parent=parent, **kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/path_spec.py", line 31, in __init__
', '.join(kwargs)))
ValueError: Unused keyword arguments: data_stream.

# Fixed code
def _ProcessFileEntryDataStream(self, mediator, file_entry, data_stream):
    """Processes a specific data stream of a file entry.

    Args:
      mediator (ParserMediator): mediates the interactions between
          parsers and other components, such as storage and abort signals.
      file_entry (dfvfs.FileEntry): file entry containing the data stream.
      data_stream (dfvfs.DataStream): data stream or None if the file entry
          has no data stream.
    """
    display_name = mediator.GetDisplayName()
    data_stream_name = getattr(data_stream, "name", "") or ""
    logging.debug(
        (
            '[ProcessFileEntryDataStream] processing data stream: "{0:s}" of '
            "file entry: {1:s}"
        ).format(data_stream_name, display_name)
    )

    mediator.ClearEventAttributes()

    if data_stream and self._analyzers:
        # Since AnalyzeDataStream generates event attributes it needs to be
        # called before producing events.
        self._AnalyzeDataStream(mediator, file_entry, data_stream.name)

    self._ExtractMetadataFromFileEntry(mediator, file_entry, data_stream)

    # Not every file entry has a data stream. In such cases we want to
    # extract the metadata only.
    if not data_stream:
        return

    # Determine if the content of the file entry should not be extracted.
    skip_content_extraction = self._CanSkipContentExtraction(file_entry)
    if skip_content_extraction:
        display_name = mediator.GetDisplayName()
        logging.debug("Skipping content extraction of: {0:s}".format(display_name))
        self.processing_status = definitions.PROCESSING_STATUS_IDLE
        return

    path_spec = copy.deepcopy(file_entry.path_spec)
    if data_stream and not data_stream.IsDefault():
        path_spec.data_stream = data_stream.name

    archive_types = []
    compressed_stream_types = []

    if self._process_compressed_streams:
        compressed_stream_types = self._GetCompressedStreamTypes(mediator, path_spec)

    if not compressed_stream_types:
        archive_types = self._GetArchiveTypes(mediator, path_spec)

    if archive_types:
        if self._process_archives:
            self._ProcessArchiveTypes(mediator, path_spec, archive_types)

        if dfvfs_definitions.TYPE_INDICATOR_ZIP in archive_types:
            # ZIP files are the base of certain file formats like docx.
            self._ExtractContentFromDataStream(mediator, file_entry, data_stream.name)

    elif compressed_stream_types:
        self._ProcessCompressedStreamTypes(mediator, path_spec, compressed_stream_types)

    else:
        self._ExtractContentFromDataStream(mediator, file_entry, data_stream.name)