def viterbi(hmm, obs): # initialize empty Matrix V = [] B = [] N = len(hmm.states) T = len(obs) #initialize for q in range(1, N-1):