code: def read_xconfig_file(xconfig_filename, existing_layers=None):
      if existing_layers is None:
          existing_layers = []
      try:
          f = open(xconfig_filename, "r")
      except Exception as e:
          sys.exit(
              "{0}: error reading xconfig file '{1}'; error was {2}".format(
                  sys.argv[0], xconfig_filename, repr(e)
              )
          )
      all_layers = []
      while True:
          line = f.readline()
          if line == "":
              break
          # the next call will raise an easy-to-understand exception if
          # it fails.
          this_layer = xconfig_line_to_object(line, existing_layers)
          if this_layer is None:
              continue  # line was blank after removing comments.
          all_layers.append(this_layer)
          existing_layers.append(this_layer)
      if len(all_layers) == 0:
          raise RuntimeError(
              "{0}: xconfig file '{1}' is empty".format(
                  sys.argv[0], xconfig_filename
              )
          )
      f.close()
      return all_layers
  
file_path: espnet/egs2/iwslt14/mt1/steps/libs/nnet3/xconfig/parser.py
imports: from __future__ import print_function
  import logging
  import sys
  import libs.nnet3.xconfig.layers
  import libs.nnet3.xconfig.utils
  import libs.common
label_desc: Use image node_id 3 for calling a global function with example usage: read_xconfig_file(xconfig_filename, existing_layers) and returns: all_layers