input: Write a function to generate a fuzzy search algorithm in Python that matches strings with near similarities. The algorithm should use the Levenshtein distance to determine the similarity between the query and the choices.
  def find_matches(query, choices, threshold):
      query, choices = query.lower(), [choice.lower() for choice in choices]
      matches = []
      
      for choice in choices:
          distance = levenshtein_distance(query, choice)
          if distance <= threshold:
              matches.append(choice)
      
      return matches
  
  assert find_matches('apple', ['apfel', 'banana', 'apple'], 2) == ['apfel', 'apple']
  assert find_matches('cat', ['cot', 'cut', 'dog'], 1) == ['cot', 'cut']
  assert find_matches('hello', ['helo', 'jello', 'yellow'], 1) == ['helo']
  assert find_matches('python', ['pyton', 'java', 'c++'], 2) == ['pyton']
  assert find_matches('test', [], 1) == []
output: def find_matches(query, choices, threshold):
      query, choices = query.lower(), [choice.lower() for choice in choices]
      matches = []
      
      for choice in choices:
          distance = levenshtein_distance(query, choice)
          if distance <= threshold:
              matches.append(choice)
      
      return matches