HMM Implementation in Python