code: def prepare_librimix_enroll(
      wav_scp,
      spk2utts,
      output_dir,
      num_spk=2,
      train=True,
      prefix="enroll_spk",
  ):
      mixtures = []
      with Path(wav_scp).open("r", encoding="utf-8") as f:
          for line in f:
              if not line.strip():
                  continue
              mixtureID = line.strip().split(maxsplit=1)[0]
              mixtures.append(mixtureID)
  
      with Path(spk2utts).open("r", encoding="utf-8") as f:
          # {spkID: [(uid1, path1), (uid2, path2), ...]}
          spk2utt = json.load(f)
  
      with DatadirWriter(Path(output_dir)) as writer:
          for mixtureID in mixtures:
              # 100-121669-0004_3180-138043-0053
              uttIDs = mixtureID.split("_")
              for spk in range(num_spk):
                  uttID = uttIDs[spk]
                  spkID = uttID.split("-")[0]
                  if train:
                      # For training, we choose the auxiliary signal on the fly.
                      # Thus, here we use the pattern f"*{uttID} {spkID}" to indicate it.
                      writer[f"{prefix}{spk + 1}.scp"][
                          mixtureID
                      ] = f"*{uttID} {spkID}"
                  else:
                      enrollID = random.choice(spk2utt[spkID])[1]
                      while (
                          enrollID == uttID and len(spk2utt[spkID]) > 1
                      ):
                          enrollID = random.choice(spk2utt[spkID])[1]
                      writer[f"{prefix}{spk + 1}.scp"][
                          mixtureID
                      ] = enrollID
  
imports: import json
  import random
  from itertools import chain
  from pathlib import Path
  from espnet2.fileio.datadir_writer import DatadirWriter
  from espnet2.utils.types import str2bool
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_librimix_enroll(wav_scp, spk2utts, output_dir, num_spk, train, prefix) without return types