code: def persist_graph(graph: "networkx.Graph", output_file: Text) -> None:
      """Plots the graph and persists it into a html file."""
      import networkx as nx
  
      expg = nx.nx_pydot.to_pydot(graph)
  
      template = rasa.shared.utils.io.read_file(
          visualization_html_path()
      )
  
      # Insert graph into template
      template = template.replace(
          "// { is-client }", "isClient = true", 1
      )
      graph_as_text = expg.to_string()
      # escape backslashes
      graph_as_text = graph_as_text.replace("\\", "\\\\")
      template = template.replace(
          "// { graph-content }", f"graph = `{graph_as_text}`", 1
      )
  
      rasa.shared.utils.io.write_text_file(template, output_file)
  
imports: from collections import defaultdict, deque
  import random
  from typing import Any, Text, List, Deque, Dict, Optional, Set, TYPE_CHECKING, Union, cast
  import rasa.shared.utils.io
  from rasa.shared.constants import INTENT_MESSAGE_PREFIX
  from rasa.shared.core.constants import ACTION_LISTEN_NAME
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import UserUttered, ActionExecuted, Event
  from rasa.shared.core.generator import TrainingDataGenerator
  from rasa.shared.core.training_data.structures import StoryGraph, StoryStep
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_VALUE, INTENT, TEXT, ENTITY_ATTRIBUTE_TYPE, INTENT_NAME_KEY
label_desc: Use image node_id 11 for calling a global function with example usage: persist_graph(graph, output_file) without return types