code: def fetch_data(splits, sample_pct, seed=1234):
      """Fetch data from specified splits for k-means training."""
      ds_splits = {}
      for split in splits:
          key = f"{split.parent}_{split.stem}"
          ds_splits[
              key
          ] = sb.dataio.dataset.DynamicItemDataset.from_json(
              json_path=split,
              output_keys=["id", "wav"],
          )
  
      data = list(itertools.chain(*ds_splits.values()))
      random.seed(seed)
      if sample_pct < 1.0:
          data = random.sample(data, int(sample_pct * len(data)))
      return iter(data), len(data)
  
imports: import sys
  import logging
  import time
  import random
  import itertools
  import pathlib
  import joblib
  import torch
  import torchaudio
  import tqdm
  import numpy
  from sklearn.cluster import MiniBatchKMeans
  from hyperpyyaml import load_hyperpyyaml
  import speechbrain
  from ljspeech_prepare import prepare_ljspeech
  from speechbrain.lobes.models.huggingface_wav2vec import HuggingFaceWav2Vec2
label_desc: Use image node_id 4 for calling a global function with example usage: fetch_data(splits, sample_pct, seed) and returns: iter,  len