Markov chain implementation in Python.