'Ensure we can access a cache file. Create a lock for it if needed.
Return whether the cache file exists yet or not.'

def init_entry(self, key):

    cache_path = self.cache_path(key)
    exists = os.path.exists(cache_path)
    if exists:
        if (not os.path.isfile(cache_path)):
            raise CacheError(('Cache    file    is    not    a    file:    %s' % cache_path))
        if (not os.access(cache_path, (os.R_OK | os.W_OK))):
            raise CacheError(('Cannot    access    cache    file:    %s' % cache_path))
    else:
        parent = os.path.dirname(cache_path)
        if (parent.rstrip(os.path.sep) != self.root):
            mkdirp(parent)
        if (not os.access(parent, (os.R_OK | os.W_OK))):
            raise CacheError(('Cannot    access    cache    directory:    %s' % parent))
        self._get_lock(key)
    return exists
