code: def diff_levenshtein(self, diffs):
      
      levenshtein = 0
      insertions = 0
      deletions = 0
      for (op, data) in diffs:
        if op == self.DIFF_INSERT:
          insertions += len(data)
        elif op == self.DIFF_DELETE:
          deletions += len(data)
        elif op == self.DIFF_EQUAL:
          # A deletion and an insertion is one substitution.
          levenshtein += max(insertions, deletions)
          insertions = 0
          deletions = 0
      levenshtein += max(insertions, deletions)
      return levenshtein
docs: Compute the Levenshtein distance; the number of inserted, deleted or
      substituted characters.
  
      Args:
        diffs: Array of diff tuples.
  
      Returns:
        Number of changes.