code: def load_kaldi(input):
      retval = kaldiio.load_mat(input)
      if isinstance(retval, tuple):
          assert len(retval) == 2, len(retval)
          if isinstance(retval[0], int) and isinstance(
              retval[1], np.ndarray
          ):
              # sound scp case
              rate, array = retval
          elif isinstance(retval[1], int) and isinstance(
              retval[0], np.ndarray
          ):
              # Extended ark format case
              array, rate = retval
          else:
              raise RuntimeError(
                  f"Unexpected type: {type(retval[0])}, {type(retval[1])}"
              )
  
          # Multichannel wave fie
          # array: (NSample, Channel) or (Nsample)
  
      else:
          # Normal ark case
          assert isinstance(retval, np.ndarray), type(retval)
          array = retval
      return array
  
file_path: espnet/espnet2/train/iterable_dataset.py
imports: import copy
  from io import StringIO
  from pathlib import Path
  from typing import Callable, Collection, Dict, Iterator, Tuple, Union
  import kaldiio
  import numpy
  import soundfile
  import torch
  from torch.utils.data.dataset import IterableDataset
  from typeguard import check_argument_types
  from espnet2.train.dataset import ESPnetDataset
label_desc: Use image node_id 1 for calling a global function with example usage: load_kaldi(input) and returns: array