docs: def nlevenshtein(seq1, seq2, method=1):
  	"""Compute the normalized Levenshtein distance between `seq1` and `seq2`.
  	
  	Two normalization methods are provided. For both of them, the normalized
  	distance will be a float between 0 and 1, where 0 means equal and 1
  	completely different. The computation obeys the following patterns:
  	
  		0.0                       if seq1 == seq2
  		1.0                       if len(seq1) == 0 or len(seq2) == 0
  		edit distance / factor    otherwise
  	
  	The `method` parameter specifies which normalization factor should be used.
  	It can have the value 1 or 2, which correspond to the following:
  	
  		1: the length of the shortest alignment between the sequences
  		   (that is, the length of the longest sequence)
  		2: the length of the longest alignment between the sequences
  	
  	Which normalization factor should be chosen is a matter of taste. The first
  	one is cheap to compute. The second one is more costly, but it accounts
  	better than the first one for parallelisms of symbols between the sequences.
  		
  	For the rationale behind the use of the second method, see:
  	Heeringa, "Measuring Dialect Pronunciation Differences using Levenshtein
  	Distance", 2004, p. 130 sq, which is available online at:
  	http://www.let.rug.nl/~heeringa/dialectology/thesis/thesis.pdf
  	"""
  	
  	if seq1 == seq2:
  		return 0.0
  	len1, len2 = len(seq1), len(seq2)
  	if len1 == 0 or len2 == 0:
  		return 1.0
  	if len1 < len2: # minimize the arrays size
  		len1, len2 = len2, len1
  		seq1, seq2 = seq2, seq1
  	
  	if method == 1:
  		return levenshtein(seq1, seq2) / float(len1)
  	if method != 2:
  		raise ValueError("expected either 1 or 2 for `method` parameter")
  	
  	column = array('L', range(len2 + 1))
  	length = array('L', range(len2 + 1))
  	
  	for x in range(1, len1 + 1):
  	
  		column[0] = length[0] = x
  		last = llast = x - 1
  		
  		for y in range(1, len2 + 1):
  		
  			# dist
  			old = column[y]
  			ic = column[y - 1] + 1
  			dc = column[y] + 1
  			rc = last + (seq1[x - 1] != seq2[y - 1])
  			column[y] = min(ic, dc, rc)
  			last = old
  			
  			# length
  			lold = length[y]
  			lic = length[y - 1] + 1 if ic == column[y] else 0
  			ldc = length[y] + 1 if dc == column[y] else 0
  			lrc = llast + 1 if rc == column[y] else 0
  			length[y] = max(ldc, lic, lrc)
  			llast = lold
  	
  	return column[y] / float(length[y])