code: def prepare_all(
      data_path: Path,
      output_path: Path,
      datasets: List[str],
      langs: List[str],
      max_sec: float,
      resolution: float,
  ):
      """Prepare all TED talks."""
  
      for dataset in datasets:  # 'train', 'dev'
          out_dir = output_path / dataset
          if not out_dir.is_dir():
              out_dir.mkdir(parents=True)
  
          wavscp_fp = open(out_dir / "wav.scp", "w")  # wav-id wav-path
          segments_fp = open(
              out_dir / "segments", "w"
          )  # utt-id wav-id start end
          text_fp = open(out_dir / "text", "w")
          textprev_fp = open(out_dir / "text.prev", "w")
          textctc_fp = open(
              out_dir / "text.ctc", "w"
          )  # text for ASR CTC w/o special tokens
          utt2spk_fp = open(out_dir / "utt2spk", "w")
          for lang in langs:
              print(f"Preparing {dataset} {lang}...")
              wav2utts = parse_data(data_path, lang, dataset)
              for wav_name, utts in wav2utts.items():
                  wav_id = f"ted_{int(wav_name[:-len('.wav')][len('ted_'):]):05d}_en_{lang}"
                  long_utts = prepare_single(
                      utts, wav_id, max_sec, resolution
                  )
                  if long_utts:
                      wavscp_fp.write(f"{wav_id} {utts[0]['wav']}\n")
                  else:
                      print(
                          f"Wav {wav_id} has no valid long utterances. Skip it."
                      )
  
                  for u in long_utts:
                      # 1. transcribe: en -> en
                      utt_id = f"{u['utt_id']}_transcribe"
                      category = (
                          "<en>"  # reserved for classification tasks
                      )
                      task = "<transcribe>"
  
                      text_fp.write(
                          f"{utt_id} {category}{task}{u['src']}\n"
                      )
                      textprev_fp.write(f"{utt_id} {u['prev_src']}\n")
                      textctc_fp.write(f"{utt_id} {u['src_ctc']}\n")
                      utt2spk_fp.write(f"{utt_id} {wav_id}\n")
                      segments_fp.write(
                          f"{utt_id} {wav_id} {u['start']:.2f} {u['end']:.2f}\n"
                      )
  
                      # 2. translate: en -> lang
                      utt_id = f"{u['utt_id']}_translate{lang}"
                      category = (
                          "<en>"  # reserved for classification tasks
                      )
                      task = f"<translate{lang}>"
  
                      text_fp.write(
                          f"{utt_id} {category}{task}{u['tgt']}\n"
                      )
                      textprev_fp.write(f"{utt_id} {u['prev_tgt']}\n")
                      textctc_fp.write(f"{utt_id} {u['src_ctc']}\n")
                      utt2spk_fp.write(f"{utt_id} {wav_id}\n")
                      segments_fp.write(
                          f"{utt_id} {wav_id} {u['start']:.2f} {u['end']:.2f}\n"
                      )
  
          wavscp_fp.close()
          segments_fp.close()
          text_fp.close()
          textprev_fp.close()
          textctc_fp.close()
          utt2spk_fp.close()
  
file_path: espnet/egs2/must_c_v2/s2t1/local/data_prep.py
imports: from argparse import ArgumentParser
  from pathlib import Path
  from typing import Dict, List, Optional, Tuple, Union
  import yaml
label_desc: Use image node_id 6 for calling a global function with example usage: prepare_all(data_path, output_path, datasets, langs, max_sec, resolution) without return types