code: def find_near_matches_generic_ngrams(subsequence, sequence, search_params):
      
      if not subsequence:
          raise ValueError('Given subsequence is empty!')
  
      matches = list(_find_near_matches_generic_ngrams(subsequence, sequence, search_params))
  
      # don't return overlapping matches; instead, group overlapping matches
      # together and return the best match from each group
      match_groups = group_matches(matches)
      best_matches = [get_best_match_in_group(group) for group in match_groups]
      return sorted(best_matches)
docs: search for near-matches of subsequence in sequence
  
      This searches for near-matches, where the nearly-matching parts of the
      sequence must meet the following limitations (relative to the subsequence):
  
      * the maximum allowed number of character substitutions
      * the maximum allowed number of new characters inserted
      * and the maximum allowed number of character deletions
      * the total number of substitutions, insertions and deletions