input: Write a function to generate a fuzzy search algorithm in Python that can match strings with near similarities. The function should be able to compare a query string with a list of choices and return those choices that have a Levenshtein distance less than or equal to a specified threshold.
  
  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", ["apples", "appel", "banana", "pineapple"], 2) == ["apples", "appel"]
  assert find_matches("kitten", ["sitting", "katt", "kate"], 3) == ["sitting"]
  assert find_matches("hello", ["helo", "halo", "help", "hero"], 1) == ["helo", "halo"]
  assert find_matches("python", ["pythong", "pythan", "pyton", "java"], 2) == ["pythong", "pythan"]
  assert find_matches("example", [], 5) == []
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