code: def _ProcessTask(self, task):
      
      logger.debug('Started processing task: {0:s}.'.format(task.identifier))
  
      if self._tasks_profiler:
        self._tasks_profiler.Sample(task, 'processing_started')
  
      self._task = task
  
      storage_writer = self._storage_writer.CreateTaskStorage(task)
  
      if self._serializers_profiler:
        storage_writer.SetSerializersProfiler(self._serializers_profiler)
  
      storage_writer.Open()
  
      self._parser_mediator.SetStorageWriter(storage_writer)
  
      storage_writer.WriteTaskStart()
  
      try:
        # TODO: add support for more task types.
        self._ProcessPathSpec(
            self._extraction_worker, self._parser_mediator, task.path_spec)
        self._number_of_consumed_sources += 1
  
        if self._guppy_memory_profiler:
          self._guppy_memory_profiler.Sample()
  
      finally:
        storage_writer.WriteTaskCompletion(aborted=self._abort)
  
        self._parser_mediator.SetStorageWriter(None)
  
        storage_writer.Close()
  
      try:
        self._storage_writer.FinalizeTaskStorage(task)
      except IOError:
        pass
  
      self._task = None
  
      if self._tasks_profiler:
        self._tasks_profiler.Sample(task, 'processing_completed')
  
      logger.debug('Completed processing task: {0:s}.'.format(task.identifier))
docs: Processes a task.
  
      Args:
        task (Task): task.