'Computes the relative levenshtein distance between two strings. It is
in the range (0-1] where 1 means total equality.
:param a: HTTPResponse object
:param b: HTTPResponse object
:return: A float with the distance'

def _relative_levenshtein(self, a, b):

    in_cache = self._distance_cache.get((a.get_id(), b.get_id()), None)
    if (in_cache is not None):
        return in_cache
    a_str = a.get_body()
    b_str = b.get_body()
    (m, n) = ((len(a_str), a_str), (len(b_str), b_str))
    if (m[0] < n[0]):
        (m, n) = (n, m)
    dist = m[0]
    for i in range(0, n[0]):
        if (m[1][i] == n[1][i]):
            dist -= 1
    longer = float(max((len(a_str), len(b_str))))
    shorter = float(min((len(a_str), len(b_str))))
    r = (((longer - dist) / longer) * (shorter / longer))
    r = (100 - (r * 100))
    self._distance_cache[(a.get_id(), b.get_id())] = r
    self._distance_cache[(b.get_id(), a.get_id())] = r
    return r
