code: def save_kaldi_format(outdir, musan_dir, ds):
      os.makedirs(outdir, exist_ok=True)
      key = os.path.basename(outdir)
  
      fp_text = open(os.path.join(outdir, "text"), "w")
      fp_wav = open(os.path.join(outdir, "wav.scp"), "w")
      fp_utt2spk = open(os.path.join(outdir, "utt2spk"), "w")
      fp_spk2utt = open(os.path.join(outdir, "spk2utt"), "w")
  
      with fp_text, fp_wav, fp_utt2spk, fp_spk2utt:
          for idx, items in enumerate(partition(ds.sort("name"))):
              uttid = "uttid-%s-%016i" % (key, idx)
              spkid = "spkid-%s-%016i" % (key, idx)
  
              audio_filepaths = []
              text = ""
              for item in items:
                  audio_filepaths.append(item["audio"]["path"])
                  text += normalize(item["transcription"])
  
              command = get_command(musan_dir, audio_filepaths)
  
              print(uttid, text, file=fp_text)
              print(uttid, command, file=fp_wav)
              print(uttid, spkid, file=fp_utt2spk)
              print(spkid, uttid, file=fp_spk2utt)
  
file_path: espnet/egs2/reazonspeech/asr1/local/data.py
imports: import getopt
  import glob
  import os
  import random
  import shlex
  import sys
  from datasets import load_dataset
label_desc: Use image node_id 6 for calling a global function with example usage: save_kaldi_format(outdir, musan_dir, ds) without return types