code: def iterative_train_test_split(X, y, test_size, random_state=None):
      """Iteratively stratified train/test split
  
      Parameters
      ----------
      test_size : float, [0,1]
          the proportion of the dataset to include in the test split, the rest will be put in the train set
  
      random_state : None | int | np.random.RandomState
          the random state seed (optional)
  
      Returns
      -------
      X_train, y_train, X_test, y_test
          stratified division into train/test split
      """
  
      stratifier = IterativeStratification(
          n_splits=2,
          order=2,
          sample_distribution_per_fold=[test_size, 1.0 - test_size],
          random_state=random_state,
      )
      train_indexes, test_indexes = next(stratifier.split(X, y))
  
      X_train, y_train = (
          X.iloc[train_indexes, :],
          y.iloc[train_indexes, :],
      )
      X_test, y_test = X.iloc[test_indexes, :], y.iloc[test_indexes, :]
  
      return X_train, X_test, y_train, y_test
  
file_path: scikit-multilearn/skmultilearn/model_selection/iterative_stratification.py
imports: from sklearn.model_selection._split import _BaseKFold
  import numpy
  import scipy.sparse
  import itertools
  from sklearn.utils import check_random_state
label_desc: Use image node_id 1 for calling a global function with example usage: iterative_train_test_split(X, y, test_size, random_state) and returns: X_train,  X_test,  y_train,  y_test