code: def subset_labels(labels, mask) -> Union[list, np.ndarray, pd.Series]:
      """Extracts subset of labels where mask is True"""
      try:  # filtering labels as if it is array or DataFrame
          return labels[mask]
      except Exception:
          try:  # filtering labels as if it is list
              return [l for idx, l in enumerate(labels) if mask[idx]]
          except Exception:
              raise TypeError(
                  "labels must be 1D np.ndarray, list, or pd.Series."
              )
  
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 18 for calling a global function with example usage: subset_labels(labels, mask) and returns: labels, unknown