code: def file_reader_helper(
      rspecifier: str,
      filetype: str = "mat",
      return_shape: bool = False,
      segments: str = None,
  ):
      """Read uttid and array in kaldi style
  
      This function might be a bit confusing as "ark" is used
      for HDF5 to imitate "kaldi-rspecifier".
  
      Args:
          rspecifier: Give as "ark:feats.ark" or "scp:feats.scp"
          filetype: "mat" is kaldi-martix, "hdf5": HDF5
          return_shape: Return the shape of the matrix,
              instead of the matrix. This can reduce IO cost for HDF5.
      Returns:
          Generator[Tuple[str, np.ndarray], None, None]:
  
      Examples:
          Read from kaldi-matrix ark file:
  
          >>> for u, array in file_reader_helper('ark:feats.ark', 'mat'):
          ...     array
  
          Read from HDF5 file:
  
          >>> for u, array in file_reader_helper('ark:feats.h5', 'hdf5'):
          ...     array
  
      """
      if filetype == "mat":
          return KaldiReader(
              rspecifier, return_shape=return_shape, segments=segments
          )
      elif filetype == "hdf5":
          return HDF5Reader(rspecifier, return_shape=return_shape)
      elif filetype == "sound.hdf5":
          return SoundHDF5Reader(rspecifier, return_shape=return_shape)
      elif filetype == "sound":
          return SoundReader(rspecifier, return_shape=return_shape)
      else:
          raise NotImplementedError(f"filetype={filetype}")
  
file_path: espnet/espnet/utils/cli_readers.py
imports: import io
  import logging
  import sys
  import h5py
  import kaldiio
  import soundfile
  from espnet.utils.io_utils import SoundHDF5File
label_desc: Use image node_id 1 for calling a global function with example usage: file_reader_helper(rspecifier, filetype, return_shape, segments) and returns: KaldiReader, HDF5Reader, SoundHDF5Reader, SoundReader