code: def cv_split(data, labels, nfold, test_id):
      assert (nfold > 1) and (test_id >= 0) and (test_id < nfold)
      lst_x = [x for i, x in enumerate(data) if i % nfold != test_id]
      lst_y = [y for i, y in enumerate(labels) if i % nfold != test_id]
      test_x = [x for i, x in enumerate(data) if i % nfold == test_id]
      test_y = [y for i, y in enumerate(labels) if i % nfold == test_id]
      perm = list(range(len(lst_x)))
      random.shuffle(perm)
      M = int(len(lst_x) * 0.9)
      train_x = [lst_x[i] for i in perm[:M]]
      train_y = [lst_y[i] for i in perm[:M]]
      valid_x = [lst_x[i] for i in perm[M:]]
      valid_y = [lst_y[i] for i in perm[M:]]
      return train_x, train_y, valid_x, valid_y, test_x, test_y
  
imports: import gzip
  import os
  import sys
  import re
  import random
  import numpy
  import torch
label_desc: Use image node_id 9 for calling a global function with example usage: cv_split(data, labels, nfold, test_id) and returns: train_x,  train_y,  valid_x,  valid_y,  test_x,  test_y