def learn_cache_key(request, response, cache_timeout=None, key_prefix=None):
    if key_prefix is None:
        key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
    if cache_timeout is None:
        cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
    cache_key = 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, request.path)
    if response.has_header('Vary'):
        headerlist = ['HTTP_'+header.upper().replace('-', '_') for header in vary_delim_re.split(response['Vary'])]
        cache.set(cache_key, headerlist, cache_timeout)
        return _generate_cache_key(request, headerlist, key_prefix)
    else:
        # if there is no Vary header, we still need a cache key
        # for the request.path
        cache.set(cache_key, [], cache_timeout)
        return _generate_cache_key(request, [], key_prefix)
This is a simplified inspect.getcallargs (2.7+).
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/cache.py/learn_cache_key--crossover with--dataset/ETHPy150Open openstack/solum/solum/common/safe_utils.py/getcallargs