Generic Markov process code