from fuzzywuzzy import fuzz, process from constants import builders def find_best_match(query): best_matches = process.extractBests(query, choices=builders, scorer=fuzz.token_set_ratio, limit=3) best_matches.insert(0, " ") return "\n".join([str(item[0]) for item in best_matches])