code: def _get_folds(n_rows, n_folds, use_stored):
          
          # n_folds = self._n_folds
          # use_stored = self._use_stored_folds
          # n_rows = self._n_rows
  
          if use_stored is not None:
              # path = '~/concise/data-offline/lw-pombe/cv_folds_5.json'
              with open(os.path.expanduser(use_stored)) as json_file:
                  json_data = json.load(json_file)
  
              # check if we have the same number of rows and folds:
              if json_data['N_rows'] != n_rows:
                  raise Exception('N_rows from folds doesnt match the number of rows of X_seq, X_feat, y')
  
              if json_data['N_folds'] != n_folds:
                  raise Exception('n_folds dont match', json_data['N_folds'], n_folds)
  
              kf = [(np.array(train), np.array(test)) for (train, test) in json_data['folds']]
          else:
              kf = KFold(n_splits=n_folds).split(np.zeros((n_rows, 1)))
  
          # store in a list
          i = 1
          folds = []
          for train, test in kf:
              fold = "fold_" + str(i)
              folds.append((fold, train, test))
              i = i + 1
          return folds
docs: Get the used CV folds