code: def _outgoing_edges_are_similar(
      graph: "networkx.MultiDiGraph", node_a: int, node_b: int
  ) -> bool:
      """If the outgoing edges from the two nodes are similar enough,
      it doesn't matter if you are in a or b.
  
      As your path will be the same because the outgoing edges will lead you to
      the same nodes anyways.
      """
      ignored = {node_b, node_a}
      a_edges = {
          (target, k)
          for target, k in _outgoing_edges(graph, node_a)
          if target not in ignored
      }
      b_edges = {
          (target, k)
          for target, k in _outgoing_edges(graph, node_b)
          if target not in ignored
      }
      return a_edges == b_edges or not a_edges or not b_edges
  
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 4 for calling a global function with example usage: _outgoing_edges_are_similar(graph, node_a, node_b) and returns: unknown