add python version of hmm implemention