code: def levenshtein(str1: str, str2: str) -> float:
      """
      Measure the similarity between two strings using Levenshtein distance,
      which gives the minimum number of character insertions, deletions, and substitutions
      needed to change one string into the other.
  
      Args:
          str1
          str2
  
      Returns:
          Similarity between ``str1`` and ``str2`` in the interval [0.0, 1.0],
          where larger values correspond to more similar strings
      """
      shortcut = _shortcut(str1, str2)
      if shortcut:
          return shortcut
  
      distance = _levenshtein(str1, str2)
      max_len = max(len(str1), len(str2))
      try:
          return 1.0 - (distance / max_len)
      except ZeroDivisionError:
          return 0.0
  
file_path: textacy/src/textacy/similarity/edits.py
imports: from __future__ import annotations
  from typing import Optional
  import sklearn.feature_extraction
  import sklearn.metrics
  from jellyfish import hamming_distance
  from jellyfish import jaro_similarity
  from jellyfish import levenshtein_distance
  from ..None import constants
label_desc: Use image node_id 3 for calling a global function with example usage: levenshtein(str1, str2) and returns: shortcut, unknown, int