code: def get_num_frames_writer(write_num_frames: str):
      """get_num_frames_writer
  
      Examples:
          >>> get_num_frames_writer('ark,t:num_frames.txt')
      """
      if write_num_frames is not None:
          if ":" not in write_num_frames:
              raise ValueError(
                  'Must include ":", write_num_frames={}'.format(
                      write_num_frames
                  )
              )
  
          nframes_type, nframes_file = write_num_frames.split(":", 1)
          if nframes_type != "ark,t":
              raise ValueError(
                  "Only supporting text mode. "
                  "e.g. --write-num-frames=ark,t:foo.txt :"
                  "{}".format(nframes_type)
              )
  
      return open(nframes_file, "w", encoding="utf-8")
  
imports: from pathlib import Path
  from typing import Dict
  import h5py
  import kaldiio
  import numpy
  import soundfile
  from espnet.utils.cli_utils import assert_scipy_wav_style
  from espnet.utils.io_utils import SoundHDF5File
label_desc: Use image node_id 2 for calling a global function with example usage: get_num_frames_writer(write_num_frames) and returns: open