code: def find_near_matches_levenshtein(subsequence, sequence, max_l_dist):
      
      if not subsequence:
          raise ValueError('Given subsequence is empty!')
      if max_l_dist < 0:
          raise ValueError('Maximum Levenshtein distance must be >= 0!')
  
      if max_l_dist == 0:
          return [
              Match(start_index, start_index + len(subsequence), 0)
              for start_index in search_exact(subsequence, sequence)
          ]
  
      elif len(subsequence) // (max_l_dist + 1) >= 3:
          return find_near_matches_levenshtein_ngrams(subsequence,
                                                      sequence,
                                                      max_l_dist)
  
      else:
          matches = find_near_matches_levenshtein_linear_programming(subsequence,
                                                                     sequence,
                                                                     max_l_dist)
          match_groups = group_matches(matches)
          best_matches = [get_best_match_in_group(group) for group in match_groups]
          return sorted(best_matches)
docs: Find near-matches of the subsequence in the sequence.
  
      This chooses a suitable fuzzy search implementation according to the given
      parameters.
  
      Returns a list of fuzzysearch.Match objects describing the matching parts
      of the sequence.