'Add a new state to the machine and return it.'

def new_state(self):

    s = Node()
    n = self.next_state_number
    self.next_state_number = (n + 1)
    s.number = n
    self.states.append(s)
    return s
