docs: def _levenshtein_distance(sentence1, sentence2):
      '''
      Return the Levenshtein distance between two strings.
      Based on:
          http://rosettacode.org/wiki/Levenshtein_distance#Python
      '''
      first = any2utf8(sentence1).decode('utf-8', 'ignore')
      second = any2utf8(sentence2).decode('utf-8', 'ignore')
      sentence1_len, sentence2_len = len(first), len(second)
      maxlen = max(sentence1_len, sentence2_len)
      if sentence1_len > sentence2_len:
          first, second = second, first
  
      distances = range(len(first) + 1)
      for index2, char2 in enumerate(second):
          new_distances = [index2 + 1]
          for index1, char1 in enumerate(first):
              if char1 == char2:
                  new_distances.append(distances[index1])
              else:
                  new_distances.append(1 + min((distances[index1],
                                               distances[index1 + 1],
                                               new_distances[-1])))
          distances = new_distances
      levenshtein = distances[-1]
      d = float((maxlen - levenshtein)/maxlen)
      # smoothing
      s = (sigmoid(d * 6) - 0.5) * 2
      # print("smoothing[%s| %s]: %s -> %s" % (sentence1, sentence2, d, s))
      return s