turing machine in python