class NoDefault(object): pass

def makeCopyParamProcessor(paramName, default=NoDefault):
    def copyParamProcessor(request):
        context_extras = {}
        try:
            value = request[paramName]
        except KeyError:
            if default is not NoDefault:
                context_extras[paramName] = default
        else:
            context_extras[paramName] = value
        return context_extras
    return copyParamProcessor

lang = makeCopyParamProcessor('lang', 'en')
testing = makeCopyParamProcessor('testing')


def LastVisitedProcessor(request):
    
    return {'back': request.session.get('last_visited', None)}
