code: def _fingerprint_node(
      graph: "networkx.MultiDiGraph", node: int, max_history: int
  ) -> Set[Text]:
      """Fingerprint a node in a graph.
  
      Can be used to identify nodes that are similar and can be merged within the
      graph.
      Generates all paths starting at `node` following the directed graph up to
      the length of `max_history`, and returns a set of strings describing the
      found paths. If the fingerprint creation for two nodes results in the same
      sets these nodes are indistinguishable if we walk along the path and only
      remember max history number of nodes we have visited. Hence, if we randomly
      walk on our directed graph, always only remembering the last `max_history`
      nodes we have visited, we can never remember if we have visited node A or
      node B if both have the same fingerprint.
      """
      # the candidate list contains all node paths that haven't been
      # extended till `max_history` length yet.
      candidates: Deque = deque()
      candidates.append([node])
      continuations = []
      while len(candidates) > 0:
          candidate = candidates.pop()
          last = candidate[-1]
          empty = True
          for _, succ_node in graph.out_edges(last):
              next_candidate = candidate[:]
              next_candidate.append(succ_node)
              # if the path is already long enough, we add it to the results,
              # otherwise we add it to the candidates
              # that we still need to visit
              if len(next_candidate) == max_history:
                  continuations.append(next_candidate)
              else:
                  candidates.append(next_candidate)
              empty = False
          if empty:
              continuations.append(candidate)
      return {
          " - ".join(
              [graph.nodes[node]["label"] for node in continuation]
          )
          for continuation in continuations
      }
  
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 1 for calling a global function with example usage: _fingerprint_node(graph, node, max_history) and returns: unknown