code: def _dump_nfa(start, finish):
      print("Dump of NFA for", start.from_rule)
      todo = [start]
      for i, state in enumerate(todo):
          print("  State", i, state is finish and "(final)" or "")
          for arc in state.arcs:
              label, next_ = arc.nonterminal_or_string, arc.next
              if next_ in todo:
                  j = todo.index(next_)
              else:
                  j = len(todo)
                  todo.append(next_)
              if label is None:
                  print("    -> %d" % j)
              else:
                  print("    %s -> %d" % (label, j))
  
imports: from ast import literal_eval
  from parso.pgen2.grammar_parser import GrammarParser, NFAState
label_desc: Use image node_id 3 for calling a global function with example usage: _dump_nfa(start, finish) without return types