Turing machine in Python.