input: Write a function to generate a fuzzy search algorithm in Python that can match strings with near similarities. The function should take a query string, a list of choices, and a threshold for the acceptable distance. If the Levenshtein distance between the query and any choice is within the threshold, the function should return that choice. If no matches are found, the function should return an empty list. If the list of choices is empty, the function should return an empty list.
  def find_matches(query, choices, threshold):
      # Convert query and choices to lower case
      query, choices = query.lower(), [choice.lower() for choice in choices]
      # Initialize empty list to store matches
      matches = []
      
      # Loop through each choice
      for choice in choices:
          # Calculate Levenshtein distance between query and choice
          distance = levenshtein_distance(query, choice)
          # If distance is less than threshold, append choice to matches
          if distance <= threshold:
              matches.append(choice)
      
      return matches
  
  assert find_matches("apple", ["pineapple", "banana", "appl", "appel"], 2) == ["pineapple", "appl", "appel"]
  assert find_matches("kitten", ["sitting", "mitten", "kitty"], 3) == ["sitting", "mitten"]
  assert find_matches("flaw", ["lawn"], 1) == []
  assert find_matches("abcd", ["efgh"], 1) == []
  assert find_matches("query", [], 2) == []
output: def find_matches(query, choices, threshold):
      query = query.lower()
      choices = [choice.lower() for choice in choices]
      matches = []
      
      for choice in choices:
          distance = levenshtein_distance(query, choice)
          if distance <= threshold:
              matches.append(choice)
      
      return matches