code: def sample_datasets(
      n_folds: int,
      train_size: float = 0.7,
      val_size: float = 0.2,
      test_size: float = 0.1,
      seed=42,
  ):
      assert isclose(
          train_size + val_size + test_size, 1.0
      ), "sizes need to add up to 1"
      random_state = np.random.RandomState(seed)
      folds = []
      for _ in range(n_folds):
          train_split, test_split = train_test_split(
              DATASETS_FILTERED,
              train_size=train_size,
              random_state=random_state.randint(low=0, high=10000),
          )
          rest = 1 - train_size
          val_split, test_split = train_test_split(
              test_split,
              test_size=test_size / rest,
              random_state=random_state.randint(low=0, high=10000),
          )
          folds.append((train_split, val_split, test_split))
          assert not any(
              [
                  set(train_split) & (set(val_split)),
                  set(train_split) & set(test_split),
                  set(val_split) & set(test_split),
              ]
          ), "Splits should not intersect!"
      return folds
  
imports: import itertools
  from sklearn.model_selection import train_test_split
  from math import isclose
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: sample_datasets(n_folds, train_size, val_size, test_size, seed) and returns: folds