code: def test_stratified_resample():
      """Test resampling returns valid data structure and maintains class distribution."""
      trainX, trainy = load_unit_test(split="TRAIN")
      testX, testy = load_unit_test(split="TEST")
      (
          new_trainX,
          new_trainy,
          new_testX,
          new_testy,
      ) = stratified_resample(trainX, trainy, testX, testy, 0)
  
      valid_train = check_is_scitype(new_trainX, scitype="Panel")
      valid_test = check_is_scitype(new_testX, scitype="Panel")
      assert valid_test and valid_train
      # count class occurrences
      unique_train, counts_train = np.unique(trainy, return_counts=True)
      unique_test, counts_test = np.unique(testy, return_counts=True)
      unique_train_new, counts_train_new = np.unique(
          new_trainy, return_counts=True
      )
      unique_test_new, counts_test_new = np.unique(
          new_testy, return_counts=True
      )
      assert list(counts_train_new) == list(counts_train)
      assert list(counts_test_new) == list(counts_test)
  
file_path: sktime/sktime/utils/tests/test_sampling.py
imports: import numpy
  import pytest
  from sktime.datasets import load_unit_test
  from sktime.datatypes import check_is_scitype
  from sktime.utils._testing.deep_equals import deep_equals
  from sktime.utils.sampling import random_partition, stratified_resample
label_desc: Use image node_id 3 for calling a global function with example usage: test_stratified_resample() without return types