code: def prepare_librimix_enroll_v2(
      wav_scp,
      librimix_dir,
      map_mix2enroll,
      output_dir,
      num_spk=2,
      prefix="enroll_spk",
  ):
      # noqa E501: ported from https://github.com/BUTSpeechFIT/speakerbeam/blob/main/egs/libri2mix/local/create_enrollment_csv_fixed.py
      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)
  
      utt2path = {}
      for audio in chain(
          Path(librimix_dir).rglob("s1/*.wav"),
          Path(librimix_dir).rglob("s2/*.wav"),
          Path(librimix_dir).rglob("s3/*.wav"),
      ):
          pdir = audio.parent.stem
          utt2path[pdir + "/" + audio.stem] = str(audio.resolve())
  
      mix2enroll = {}
      with open(map_mix2enroll) as f:
          for line in f:
              mix_id, utt_id, enroll_id = line.strip().split()
              sid = mix_id.split("_").index(utt_id) + 1
              mix2enroll[mix_id, f"s{sid}"] = enroll_id
  
      with DatadirWriter(Path(output_dir)) as writer:
          for mixtureID in mixtures:
              # 100-121669-0004_3180-138043-0053
              for spk in range(num_spk):
                  enroll_id = mix2enroll[mixtureID, f"s{spk + 1}"]
                  writer[f"{prefix}{spk + 1}.scp"][
                      mixtureID
                  ] = utt2path[enroll_id]
  
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 2 for calling a global function with example usage: prepare_librimix_enroll_v2(wav_scp, librimix_dir, map_mix2enroll, output_dir, num_spk, prefix) without return types