code: def with_task_labels(obj):
      """Add `TaskAware` attributes.
  
      The dataset must already have task labels.
  
      `obj` must be a scenario, stream, or experience.
      """
  
      def _add_task_labels(exp):
          tls = exp.dataset.targets_task_labels.uniques
          if len(tls) == 1:
              # tls is a set. we need to convert to list to call __getitem__
              exp.task_label = list(tls)[0]
          exp.task_labels = tls
          return exp
  
      return _decorate_generic(obj, _add_task_labels)
  
file_path: avalanche/avalanche/benchmarks/scenarios/task_aware.py
imports: import warnings
  from copy import copy
  from typing import Protocol, List, Sequence
  from .generic_scenario import CLScenario, CLStream, EagerCLStream, CLExperience
  from .dataset_scenario import DatasetExperience
  from ..utils import AvalancheDataset, TaskLabels, ConstantSequence
  from ..utils.data_attribute import has_task_labels
label_desc: Use image node_id 2 for calling a global function with example usage: with_task_labels(obj) and returns: _decorate_generic, exp