code: def subset_data(X, mask) -> DatasetLike:
      """Extracts subset of data examples where mask (np.ndarray) is True"""
      try:
          import torch
  
          if isinstance(X, torch.utils.data.Dataset):
              mask_idx_list = list(np.nonzero(mask)[0])
              return torch.utils.data.Subset(X, mask_idx_list)
      except Exception:
          pass
      try:
          with warnings.catch_warnings():
              warnings.filterwarnings("ignore")
              import tensorflow
  
              if isinstance(
                  X, tensorflow.data.Dataset
              ):  # special splitting for tensorflow Dataset
                  mask_idx = np.nonzero(mask)[0]
                  return extract_indices_tf(
                      X, mask_idx, allow_shuffle=True
                  )
      except Exception:
          pass
      try:
          return X[mask]
      except Exception:
          raise TypeError(
              "Data features X must be subsettable with boolean mask array: X[mask]"
          )
  
imports: import warnings
  import numpy
  import pandas
  from typing import Union, Tuple
  from cleanlab.typing import DatasetLike, LabelLike
  from cleanlab.internal.validation import labels_to_array
  from cleanlab.internal.constants import FLOATING_POINT_COMPARISON, TINY_VALUE
label_desc: Use image node_id 19 for calling a global function with example usage: subset_data(X, mask) and returns: X, torch, extract_indices_tf