Making markov chains in python