code: def get_training_or_validation_split(
      samples, labels, validation_split, subset
  ):
      """Potentially restict samples & labels to a training or validation split.
  
      Args:
          samples: List of elements.
          labels: List of corresponding labels.
          validation_split: Float, fraction of data to reserve for validation.
          subset: Subset of the data to return.
              Either `"training"`, `"validation"`, or `None`.
              If `None`, we return all of the data.
  
      Returns:
          tuple (samples, labels), potentially restricted to the specified subset.
      """
      if not validation_split:
          return samples, labels
  
      num_val_samples = int(validation_split * len(samples))
      if subset == "training":
          io_utils.print_msg(
              f"Using {len(samples) - num_val_samples} "
              f"files for training."
          )
          samples = samples[:-num_val_samples]
          if labels is not None:
              labels = labels[:-num_val_samples]
      elif subset == "validation":
          io_utils.print_msg(
              f"Using {num_val_samples} files for validation."
          )
          samples = samples[-num_val_samples:]
          if labels is not None:
              labels = labels[-num_val_samples:]
      else:
          raise ValueError(
              '`subset` must be either "training" '
              f'or "validation", received: {subset}'
          )
      return samples, labels
  
imports: import os
  import random
  import time
  import warnings
  from multiprocessing.pool import ThreadPool
  import numpy
  from keras.api_export import keras_export
  from keras.utils import io_utils
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 15 for calling a global function with example usage: get_training_or_validation_split(samples, labels, validation_split, subset) and returns: samples,  labels, samples,  labels