code: def levenshtein_distance(a: str, b: str) -> int:
      """Return the Levenshtein edit distance between two strings *a* and *b*."""
      if a == b:
          return 0
      if len(a) < len(b):
          a, b = b, a
      if not a:
          return len(b)
      previous_row = list(range(len(b) + 1))
      for i, column1 in enumerate(a):
          current_row = [i + 1]
          for j, column2 in enumerate(b):
              insertions = previous_row[j + 1] + 1
              deletions = current_row[j] + 1
              substitutions = previous_row[j] + (column1 != column2)
              current_row.append(
                  min(insertions, deletions, substitutions)
              )
          previous_row = current_row
      return previous_row[-1]
  
file_path: sphinx/sphinx/versioning.py
imports: from __future__ import annotations
  import pickle
  from itertools import product, zip_longest
  from operator import itemgetter
  from os import path
  from typing import TYPE_CHECKING, Any
  from uuid import uuid4
  from sphinx.transforms import SphinxTransform
label_desc: Use image node_id 4 for calling a global function with example usage: levenshtein_distance(a, b) and returns: previous_row, int, len