Returns the content of a cache item or the given default

def cache_get(cache_dir, cache_key, default=None):
    """
    Returns the content of a cache item or the given default
    """
    filename = os.path.join(cache_dir, cache_key)

    if os.path.isfile(filename):
        with open(filename, 'r') as f:
            return f.read()

    return default