input: def find_matches(query, choices, threshold):
      """Generate a fuzzy search algorithm that can match strings with near similarities.
      The function takes a query string, a list of choices, and a threshold for the distance.
      It converts both the query and the choices to lower case, calculates the Levenshtein distance
      between the query and each choice, and returns a list of choices that have a distance 
      less than or equal to the given threshold.
      
      >>> find_matches('apple', ['pple', 'aple', 'banana', 'applepie'], 2)
      ['pple', 'aple']
      >>> find_matches('banana', ['bana', 'neau', 'applebanana'], 3)
      ['bana', 'neau']
      """
output:     from Levenshtein import distance
      
      query = query.lower()
      matches = []
      
      for choice in choices:
          if distance(query, choice.lower()) <= threshold:
              matches.append(choice)
      
      return matches