code: def splitset(num_trials, skipstep=None):
      
      split = num_trials // 2
  
      a = list(range(0, split))
      b = list(range(split, num_trials))
      yield a, b
      yield b, a
docs: Split-set cross validation
  
      Use half the trials for training, and the other half for testing. Then
      repeat the other way round.
  
      Parameters
      ----------
      num_trials : int
          Total number of trials
      skipstep : int
          unused
  
      Returns
      -------
      gen : generator object
          the generator returns tuples (trainset, testset)