def get_urls(version, term):
    """
    Gets the set of URLs for <term> in <version>.

    Returns a list of (score, url) tuples, sorted by score descending.
    """
    # Sort the set of URLs in redirects:v1:term by the scores (clicks) in
    # redirects:v1:term:url, then get each score along with each URL.
    # This returns a list [score, url, score, url, ...]
    urls = r.sort('redirects:v2:%s:%s' % (version, term),
                  by   = 'redirects:v2:%s:%s:*' % (version, term),
                  get  = ('redirects:v2:%s:%s:*' % (version, term), '#'),
                  desc = True)

    # Convert that to a list of tuples [(score, url), (score, url), ...]
    return zip(urls[::2], urls[1::2])
dataset/ETHPy150Open djangome/djangome/djangome/views.py/get_urls/original