code: def test_subsample_classification_unique_labels_stay_in_training_set(
      y, random_state
  ):
      n_samples = len(y)
      X = np.random.random(size=(n_samples, 3))
      sample_size = 100
  
      values, counts = np.unique(y, axis=0, return_counts=True)
      unique_labels = [
          value for value, count in zip(values, counts) if count == 1
      ]
      assert len(
          unique_labels
      ), "Ensure we have unique labels in the test"
  
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          X_sampled, y_sampled = subsample(
              X,
              y,
              random_state=random_state,
              sample_size=sample_size,
              is_classification=True,
          )
  
      assert X_sampled.dtype == X.dtype and y_sampled.dtype == y.dtype
      assert len(y_sampled) == sample_size
      assert all(
          label in y_sampled for label in unique_labels
      ), f"sampled unique = {np.unique(y_sampled)}, original unique = {unique_labels}"
  
imports: from typing import Any, Dict, List, Union
  import warnings
  from itertools import chain
  import numpy
  import pandas
  import sklearn.datasets
  from scipy.sparse import csr_matrix, spmatrix
  from autosklearn.constants import BINARY_CLASSIFICATION, CLASSIFICATION_TASKS, MULTICLASS_CLASSIFICATION, MULTILABEL_CLASSIFICATION, MULTIOUTPUT_REGRESSION, REGRESSION, REGRESSION_TASKS
  from autosklearn.util.data import default_dataset_compression_arg, reduce_dataset_size_if_too_large, reduce_precision, reduction_mapping, subsample, supported_precision_reductions, validate_dataset_compression_arg
  import pytest
label_desc: Use image node_id 11 for calling a global function with example usage: test_subsample_classification_unique_labels_stay_in_training_set(y, random_state) without return types