code: def read_mat_ark(file_or_fd):
      """This function reads a kaldi matrix archive in text format
      and yields a dictionary output indexed by the key (utterance-id).
      The input can be a file or an opened file descriptor.
  
      Example usage:
      mat_dict = { key: mat for key, mat in read_mat_ark(file) }
      """
      try:
          fd = open(file_or_fd, "r")
          fname = file_or_fd
      except TypeError:
          # 'file_or_fd' is opened file descriptor,
          fd = file_or_fd
          fname = file_or_fd.name
  
      try:
          key = read_key(fd)
          while key:
              mat = read_matrix_ascii(fd)
              yield key, mat
              key = read_key(fd)
      finally:
          if fd is not file_or_fd:
              fd.close()
  
imports: from __future__ import print_function
  from __future__ import division
  import argparse
  import logging
  import math
  import os
  import subprocess
  import sys
  import threading
label_desc: Use image node_id 21 for calling a global function with example usage: read_mat_ark(file_or_fd) without return types