code: def _are_stratification_allowed(
      data: Union[InputData, MultiModalData], split_ratio: float
  ) -> bool:
      """Check that stratification may be done
      :param data: data for split
      :param split_ratio: relation between train data length and all data length
      :return bool: stratification is allowed"""
  
      # check task_type
      if data.task.task_type is not TaskTypesEnum.classification:
          return False
  
      try:
          # fast way
          classes = np.unique(data.target, return_counts=True)
      except Exception:
          # slow way
          from collections import Counter
  
          classes = Counter(data.target)
          classes = [list(classes), list(classes.values())]
  
      # check that there are enough labels for two samples
      if not all(x > 1 for x in classes[1]):
          if __debug__:
              # tests often use very small datasets that are not suitable for data splitting
              # stratification is disabled for tests
              return False
          else:
              raise ValueError(
                  (
                      "There is the only value for some classes:"
                      f" {', '.join(str(val) for val, count in zip(*classes) if count == 1)}."
                      f" Data split can not be done for {data.task.task_type.name} task."
                  )
              )
  
      # check that split ratio allows to set all classes to both samples
      test_size = round(len(data.target) * (1.0 - split_ratio))
      labels_count = len(classes[0])
      if test_size < labels_count:
          return False
  
      return True
  
file_path: FEDOT/fedot/core/data/data_split.py
imports: from copy import deepcopy
  from typing import Tuple, Optional, Union
  import numpy
  from sklearn.model_selection import train_test_split
  from fedot.core.data.data import InputData
  from fedot.core.data.multi_modal import MultiModalData
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import TaskTypesEnum
label_desc: Use image node_id 4 for calling a global function with example usage: _are_stratification_allowed(data, split_ratio) and returns: True, False, False, False