input: 
  from typing import List
  
  def levenshtein_distance(str1: str, str2: str) -> int:
      """ Helper function to calculate Levenshtein distance between two strings. """
      pass
  
  def find_matches(query: str, choices: List[str], threshold: float) -> List[str]:
      """ Given a query string and a list of choices, find all strings in choices that
      have a Levenshtein distance less than or equal to the given threshold when compared to
      the query string. All comparisons are performed in lowercase.
      >>> find_matches('apple', ['appel', 'ape', 'mango'], 1)
      ['appel']
      >>> find_matches('cod', ['code', 'cob', 'cold'], 2)
      ['code', 'cob', 'cold']
      """
      # 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
  
output:     
  def levenshtein_distance(str1: str, str2: str) -> int:
      """ Helper function to calculate Levenshtein distance between two strings. """
      if len(str1) < len(str2):
          return levenshtein_distance(str2, str1)
  
      if len(str2) == 0:
          return len(str1)
  
      previous_row = range(len(str2) + 1)
      for i, c1 in enumerate(str1):
          current_row = [i + 1]
          for j, c2 in enumerate(str2):
              insertions = previous_row[j + 1] + 1
              deletions = current_row[j] + 1
              substitutions = previous_row[j] + (c1 != c2)
              current_row.append(min(insertions, deletions, substitutions))
          previous_row = current_row
      
      return previous_row[-1]
  