import hashlib


def _generate_filename(url):
    """
    Hash the original URL to get a safe filename.
    """
    sha1 = hashlib.sha1()
    sha1.update(url)
    return '{}.jpg'.format(sha1.hexdigest())