code: def to_dot(self):
          
          from graphviz import Digraph
          dot = Digraph(format='png')
          for state in self.states:
              if isinstance(state, TransientState):
                  dot.node(state.state_id, style='dashed')
              else:
                  dot.node(state.state_id)
              for transition in state.transition_set:
                  dot.edge(state.state_id, transition.output.state_id, transition.label())
          return dot
docs: Produces a ball and stick graph of this state machine.
  
          Returns
          -------
          `graphviz.Digraph`
              A ball and stick visualization of this state machine.