Generates the cache key for the given string using the content in pattern
    to format the output string

def generate_key(s, pattern="%s.txt"):
    """
    Generates the cache key for the given string using the content in pattern
    to format the output string
    """
    h = hashlib.sha1()
    #h.update(s)
    h.update(s.encode('utf-8'))
    return pattern % h.hexdigest()