(s1, s2)
return distances[-1]
:param s1:  A list or string
    :param s2:  Another list or string
    :returns:    The levenshtein distance between the two
:param s1:  A list or string
    :param s2:  Another list or string
    :returns:    The levenshtein distance between the two
: param s1 : A list or string : param s2 : Another list or string : returns : The levenshtein distance between the two
def _levenshtein_distance(s1, s2):
    """
    :param s1:  A list or string
    :param s2:  Another list or string
    :returns:    The levenshtein distance between the two
    """
    if len(s1) > len(s2):
        s1, s2 = s2, s1
    distances = range(len(s1) + 1)
    for index2, num2 in enumerate(s2):
        new_distances = [index2 + 1]
        for index1, num1 in enumerate(s1):
            if num1 == num2:
                new_distances.append(distances[index1])
            else:
                new_distances.append(1 + min((distances[index1],
                                             distances[index1+1],
                                             new_distances[-1])))
        distances = new_distances
    return distances[-1]
def _levenshtein_distance ( s1 , s2 ) : if len ( s1 ) > len ( s2 ) : s1 , s2 = s2 , s1 distances = range ( len ( s1 ) + 1 ) for index2 , num2 in enumerate ( s2 ) : new_distances = [ index2 + 1 ] for index1 , num1 in enumerate ( s1 ) : if num1 == num2 : new_distances . append ( distances [ index1 ] ) else : new_distances . append ( 1 + min ( ( distances [ index1 ] , distances [ index1 + 1 ] , new_distances [ - 1 ] ) ) ) distances = new_distances return distances [ - 1 ]