code: def get_graphviz_dot(machine):
      
      s = []
      s.append('digraph G {\n')
      s.append('node [shape=box style=rounded fontname=Helvetica];\n')
      s.append('edge [ fontname=Helvetica ];\n')
      # initial state
      s.append('initial [shape=point width=0.2];\n')
      # final states
      counter = 1
      for t_id in machine._table:
          transition = machine._table[t_id]
          if not transition.internal:
              if transition.target is 'final':
                  s.append('f{} [shape=doublecircle width=0.1 label="" style=filled fillcolor=black];\n'.format(counter))
              counter = counter + 1
  
      for state_name in machine._states:
          s.append(_print_state(machine._states[state_name]))
      # initial transition
      counter = 0
      s.append(_print_transition(machine._intial_transition, counter))
      counter = 1
      for t_id in machine._table:
          transition = machine._table[t_id]
          if not transition.internal:
              s.append(_print_transition(transition, counter))
              counter = counter + 1
      s.append('}')
      return ''.join(s)
docs: Return the graph of the state machine.
  
      The format is the dot format for Graphviz, and can be directly used as input
      to Graphviz.
  
      To learn more about Graphviz, visit https://graphviz.gitlab.io.
  
      **Display in Jupyter Notebook**
      Install Python support for Graphviz via `pip install graphviz`.
      Install Graphviz.
      In a notebook, build a stmpy.Machine. Then, declare a cell with the
      following content:
  
          from graphviz import Source
          src = Source(stmpy.get_graphviz_dot(stm))
          src
  
      **Using Graphviz on the Command Line**
  
      Write the graph file with the following code:
  
          with open("graph.gv", "w") as file:
          print(stmpy.get_graphviz_dot(stm), file=file)
  
      You can now use the command line tools from Graphviz to create a graphic
      file with the graph. For instance:
  
          dot -Tsvg graph.gv -o graph.svg