import re


def read_urls(filename):
    """Returns a list of the puzzle urls from the given log file,
    extracting the hostname from the filename itself.
    Screens out duplicate urls and returns the urls sorted into
    increasing order."""
    # REGEX => r'/edu/languages/google-python-class/images/puzzle/\w-\w{4}[-\w{4}]*.jpg'

    with open(filename) as texto:
        contents = texto.read()

    regex = re.compile(r'/edu/languages/google-python-class/images/puzzle/\w-\w{4}[-\w{4}]*.jpg')
    urls_list_tmp = list(set(re.findall(regex, contents)))
    urls_list_tmp.sort(key = lambda x: x[-8:])
    urls_list = []
    for url in urls_list_tmp:
        urls_list.append('http://code.google.com' + url)

    return urls_list