code: def relative(a, b):
      """Returns the relative distance between two strings, in the range
      [0-1] where 1 means total equality.
      """
  
      d = distance(a, b)
      longer = float(max((len(a), len(b))))
      shorter = float(min((len(a), len(b))))
      r = ((longer - d) / longer) * (shorter / longer)
      return r
  
imports: from whoosh.compat import xrange
label_desc: Use image node_id 3 for calling a global function with example usage: relative(a, b) and returns: r