code: def split_datasets(
      X, y, n_folds=3, shuffle_data=False, random_state=None
  ):
      """Utility function to split the data for stacking. The data is split
      into n_folds with roughly equal rough size.
  
      Parameters
      ----------
      X : numpy array of shape (n_samples, n_features)
          The input samples.
  
      y : numpy array of shape (n_samples,)
          The ground truth of the input samples (labels).
  
      n_folds : int, optional (default=3)
          The number of splits of the training sample.
  
      shuffle_data : bool, optional (default=False)
          If True, shuffle the input data.
  
      random_state : RandomState, optional (default=None)
          A random number generator instance to define the state of the random
          permutations generator.
  
      Returns
      -------
      X : numpy array of shape (n_samples, n_features)
          The input samples. If shuffle_data, return the shuffled data.
  
      y : numpy array of shape (n_samples,)
          The ground truth of the input samples (labels). If shuffle_data,
          return the shuffled data.
  
      index_lists : list of list
          The list of indexes of each fold regarding the returned X and y.
          For instance, index_lists[0] contains the indexes of fold 0.
  
      """
  
      if not isinstance(n_folds, int):
          raise ValueError("n_folds must be an integer variable")
      check_parameter(
          n_folds, low=2, include_left=True, param_name="n_folds"
      )
  
      random_state = check_random_state(random_state)
  
      if shuffle_data:
          X, y = shuffle(X, y, random_state=random_state)
  
      idx_length = len(y)
      idx_list = list(range(idx_length))
  
      avg_length = int(idx_length / n_folds)
  
      index_lists = []
      for i in range(n_folds - 1):
          index_lists.append(
              idx_list[i * avg_length : (i + 1) * avg_length]
          )
  
      index_lists.append(idx_list[(n_folds - 1) * avg_length :])
  
      return X, y, index_lists
  
file_path: combo/combo/models/classifier_stacking.py
imports: import warnings
  import numpy
  from sklearn.linear_model import LogisticRegression
  from sklearn.utils import shuffle
  from sklearn.utils import check_random_state
  from sklearn.utils import check_array
  from sklearn.utils import check_X_y
  from sklearn.utils.validation import check_is_fitted
  from pyod.utils.utility import check_parameter
  from ..utils.utility import list_diff
  from .base import BaseAggregator
label_desc: Use image node_id 1 for calling a global function with example usage: split_datasets(X, y, n_folds, shuffle_data, random_state) and returns: X,  y,  index_lists