code: def initalize_kaldi(cfg: KaldiInitializerConfig) -> Path:
      if cfg.fst_dir is None:
          cfg.fst_dir = osp.join(cfg.data_dir, "kaldi")
      if cfg.out_labels is None:
          cfg.out_labels = cfg.in_labels
  
      kaldi_root = Path(cfg.kaldi_root)
      data_dir = Path(cfg.data_dir)
      fst_dir = Path(cfg.fst_dir)
      fst_dir.mkdir(parents=True, exist_ok=True)
  
      arpa_base = osp.splitext(osp.basename(cfg.lm_arpa))[0]
      unique_label = f"{cfg.in_labels}.{arpa_base}"
  
      with open(data_dir / f"dict.{cfg.in_labels}.txt", "r") as f:
          vocab = Dictionary.load(f)
  
      in_units_file = create_units(fst_dir, cfg.in_labels, vocab)
  
      grammar_graph, out_words_file = create_G(
          kaldi_root, fst_dir, Path(cfg.lm_arpa), arpa_base
      )
  
      disambig_lexicon_file, disambig_L_in_units_file = create_lexicon(
          cfg, fst_dir, unique_label, in_units_file, out_words_file
      )
  
      h_graph, h_out_units_file, disambig_in_units_file_int = create_H(
          kaldi_root,
          fst_dir,
          disambig_L_in_units_file,
          cfg.in_labels,
          vocab,
          cfg.blank_symbol,
          cfg.silence_symbol,
      )
      lexicon_graph = create_L(
          kaldi_root,
          fst_dir,
          unique_label,
          disambig_lexicon_file,
          disambig_L_in_units_file,
          out_words_file,
      )
      lg_graph = create_LG(
          kaldi_root,
          fst_dir,
          unique_label,
          lexicon_graph,
          grammar_graph,
      )
      hlga_graph = create_HLGa(
          kaldi_root,
          fst_dir,
          unique_label,
          h_graph,
          lg_graph,
          disambig_in_units_file_int,
      )
      hlg_graph = create_HLG(
          kaldi_root, fst_dir, unique_label, hlga_graph
      )
  
      # for debugging
      # hla_graph = create_HLa(kaldi_root, fst_dir, unique_label, h_graph, lexicon_graph, disambig_in_units_file_int)
      # hl_graph = create_HLG(kaldi_root, fst_dir, unique_label, hla_graph, prefix="HL_looped")
      # create_HLG(kaldi_root, fst_dir, "phnc", h_graph, prefix="H_looped")
  
      return hlg_graph
  
imports: from dataclasses import dataclass
  import hydra
  from hydra.core.config_store import ConfigStore
  import logging
  from omegaconf import MISSING, OmegaConf
  import os
  import os.path
  from pathlib import Path
  import subprocess
  from typing import Optional
  from fairseq.data.dictionary import Dictionary
  from fairseq.dataclass import FairseqDataclass
label_desc: Use image node_id 10 for calling a global function with example usage: initalize_kaldi(cfg) and returns: hlg_graph