code: def rationed_split(examples, train_ratio, test_ratio, val_ratio, rnd):
      """Create a random permutation of examples, then split them by ratios
  
      Arguments:
          examples: a list of data
          train_ratio, test_ratio, val_ratio: split fractions.
          rnd: a random shuffler
  
      Examples:
          >>> examples = []
          >>> train_ratio, test_ratio, val_ratio = 0.7, 0.2, 0.1
          >>> rnd = torchtext.data.dataset.RandomShuffler(None)
          >>> train_examples, test_examples, valid_examples = \
                  torchtext.data.dataset.rationed_split(examples, train_ratio,
                                                        test_ratio, val_ratio,
                                                        rnd)
      """
      N = len(examples)
      randperm = rnd(range(N))
      train_len = int(round(train_ratio * N))
  
      # Due to possible rounding problems
      if not val_ratio:
          test_len = N - train_len
      else:
          test_len = int(round(test_ratio * N))
  
      indices = (
          randperm[:train_len],  # Train
          randperm[train_len : train_len + test_len],  # Test
          randperm[train_len + test_len :],
      )  # Validation
  
      # There's a possibly empty list for the validation set
      data = tuple([examples[i] for i in index] for index in indices)
  
      return data
  
imports: import csv
  import gzip
  import io
  import os
  import shutil
  import tarfile
  import zipfile
  from functools import partial
  import torch.utils.data
  from torchtext.data.utils import RandomShuffler
  from torchtext.utils import download_from_url
  from .example import Example
label_desc: Use image node_id 3 for calling a global function with example usage: rationed_split(examples, train_ratio, test_ratio, val_ratio, rnd) and returns: data