def lookup(url):
    """return search result if the URL is in the db or None on a cache miss."""
    data = db.find_one({'url': url}) or {}
    return data.get('links', None)
return search result if the URL is in the db or None on a cache miss.
app/query_cache.py