def access_cached(func):
    def inner(self, context):
        session = context['request'].session
        try:
            if session['allowed']['valid_for'] != session.get('token'):
                raise KeyError()
        except __HOLE__:
            session['allowed'] = {"valid_for": session.get('token')}

        key = "%s.%s" % (self.__class__.__module__, self.__class__.__name__)
        if key not in session['allowed']:
            session['allowed'][key] = func(self, context)
            session.modified = True
        return session['allowed'][key]
    return inner
dataset/ETHPy150Open CiscoSystems/avos/horizon/base.py/access_cached