A simple Finite State Machine using Python