old_contents: import math
  #Log-likelihood
  def ll(ciphertext,perm,mat):
  	s=0.0
  	c1 = ciphertext[0]
  	for c2 in ciphertext[1:]:
  		#print math.log(mat[(perm[c1],perm[c2])])
  		s = s + math.log(mat[(perm[c1],perm[c2])])
  		c1=c2
  	return s
new_contents: import math
  #Log-likelihood
  def ll(ciphertext,perm,mat,k=2):
      s=0.0
      for i in range(len(ciphertext)-(k-1)):
          kmer = tuple([perm[c] for c in ciphertext[i:i+k]])
          s = s + math.log(mat[kmer])
      return s
  
subject: Rewrite ll (log likelihood) function to work with arbitrary values of k (kmer length)