def find_used_word(self, url): words = {} for word in split_words(url): if exists_used_word_in_db(word): words.setdefault(word, get_last_modified_in_db(word)) oldest_word = "" if bool(words): oldest_word = min(words) else: oldest_word = choose_last_modified_used_word_in_db() return select_used_word_in_db(oldest_word, url)
def find_url(self, word): if exists_used_word_in_db(word): return get_url_in_db(word) return None