code: def load_graph(graph_path: str) -> "k2.Fsa":
      """Fsa graph loading helper function. Loads graphs stored in different formats."""
      if os.path.exists(graph_path):
          errors = []
          try:
              graph_dict = torch.load(graph_path, map_location="cpu")
              graph = k2.Fsa.from_dict(graph_dict)
              return graph
          except UnpicklingError as e:
              errors.append(e)
              with open(graph_path, "rt", encoding="utf-8") as f:
                  graph_txt = f.read()
              # order from the most frequent case to the least
              for func, acceptor in [
                  (k2.Fsa.from_openfst, False),
                  (k2.Fsa.from_str, True),
                  (k2.Fsa.from_str, False),
              ]:
                  try:
                      graph = func(graph_txt, acceptor=acceptor)
                      return graph
                  except (TypeError, ValueError, RuntimeError) as e:
                      errors.append(e)
          raise Exception(errors)
      else:
          logging.warning(f"""No such file: '{graph_path}'""")
          return None
  
imports: import os
  import struct
  from pickle import UnpicklingError
  from typing import List, Optional, Tuple, Union
  import torch
  from nemo.core.utils.k2_guard import k2
  from nemo.utils import logging
label_desc: Use image node_id 6 for calling a global function with example usage: load_graph(graph_path) and returns: None, graph, graph