Python implementation of a markov word chain