input: from typing import List
  
  def find_matches(query: str, choices: List[str], threshold: int) -> List[str]:
      """
      Generate a fuzzy search algorithm in Python that can match strings with near similarities.
      Converts the query and choices to lower case, then calculates the Levenshtein distance between
      each choice and the query. Matches are returned if the distance is less than or equal to the threshold.
  
      >>> find_matches("apple", ["apples", "banana", "pineapple"], 1)
      ['apples']
      >>> find_matches("cat", ["bat", "car", "cart"], 2)
      ['bat', 'car']
      """
output:     from Levenshtein import distance
      
      query = query.lower()
      matches = []
      
      for choice in choices:
          if distance(query, choice.lower()) <= threshold:
              matches.append(choice)
      
      return matches