code: def random_initialization_balanced(y, n_samples=10):
      """Randomly draws a subset which is (approximately) balanced in the distribution
      of its class labels.
  
      Parameters
      ----------
      y : np.ndarray[int] or csr_matrix
          Labels to be used for balanced sampling.
      n_samples : int, default=10
          Number of samples to draw.
  
      Returns
      -------
      indices : np.ndarray[int]
          Indices relative to y.
  
      Notes
      -----
      This is only applicable to single-label classification.
      """
      if isinstance(y, csr_matrix):
          raise NotImplementedError()
      else:
          return balanced_sampling(y, n_samples=n_samples)
  
file_path: small-text/small_text/initialization/strategies.py
imports: import numpy
  from scipy.sparse import csr_matrix
  from small_text.utils.data import list_length
  from small_text.data.sampling import balanced_sampling
  from small_text.data.sampling import multilabel_stratified_subsets_sampling
  from small_text.data.sampling import stratified_sampling
label_desc: Use image node_id 3 for calling a global function with example usage: random_initialization_balanced(y, n_samples) and returns: balanced_sampling