code: def _indexes_from_set(
      sequence: Sequence[SupportsInt],
      search_elements: Union[Sequence[int], None],
      bucket_classes: bool = True,
      sort_classes: bool = False,
      sort_indexes: bool = False,
  ) -> Union[List[int], None]:
      """
      Given the target list of a dataset, returns the indexes of patterns
      belonging to classes listed in the search_elements parameter.
  
      :param sequence: The list of pattern targets, as a list.
      :param search_elements: A list of classes used to filter the dataset
          patterns. Patterns belonging to one of those classes will be included.
          If None, all patterns will be included.
      :param bucket_classes: If True, pattern indexes will be returned so that
          patterns will be grouped by class. Defaults to True.
      :param sort_classes: If both ``bucket_classes`` and ``sort_classes`` are
          True, class groups will be sorted by class index. Ignored if
          ``bucket_classes`` is False. Defaults to False.
      :param sort_indexes: If True, patterns indexes will be sorted. When
          bucketing by class, patterns will be sorted inside their buckets.
          Defaults to False.
  
      :returns: The indexes of patterns belonging to the required classes,
          as a list. Can return None, which means that the original pattern
          sequence already satisfies all the constraints.
      """
      if bucket_classes:
          return _indexes_grouped_by_classes(
              sequence,
              search_elements,
              sort_indexes=sort_indexes,
              sort_classes=sort_classes,
          )
  
      return _indexes_without_grouping(
          sequence, search_elements, sort_indexes=sort_indexes
      )
  
file_path: avalanche/avalanche/benchmarks/scenarios/deprecated/new_classes/nc_utils.py
imports: from collections import OrderedDict
  from typing import List, Sequence, Dict, Any, Union, SupportsInt
  import torch
  from avalanche.benchmarks.utils import _taskaware_classification_subset, SupportedDataset
  from avalanche.benchmarks.utils import tensor_as_list
  from avalanche.benchmarks.utils.classification_dataset import TaskAwareClassificationDataset
label_desc: Use image node_id 3 for calling a global function with example usage: _indexes_from_set(sequence, search_elements, bucket_classes, sort_classes, sort_indexes) and returns: _indexes_without_grouping, _indexes_grouped_by_classes