'Directory used for caching data.
Note:
May be either a path string, or :const:`None`.
Example:
>>> cache_dir = context.cache_dir
>>> cache_dir is not None
True
>>> os.chmod(cache_dir, 0o000)
>>> context.cache_dir is None
True
>>> os.chmod(cache_dir, 0o755)
>>> cache_dir == context.cache_dir
True'

@property
def cache_dir(self):

    home = os.path.expanduser('~')
    if (not os.access(home, os.W_OK)):
        return None
    cache = os.path.join(home, '.pwntools-cache')
    if (not os.path.exists(cache)):
        try:
            os.mkdir(cache)
        except OSError:
            return None
    if (not os.access(cache, os.W_OK)):
        return None
    return cache
