'Obtains the current session variables.'

def _session(self):

    if ('django.contrib.sessions' in settings.INSTALLED_APPS):
        engine = import_module(settings.SESSION_ENGINE)
        cookie = self.cookies.get(settings.SESSION_COOKIE_NAME, None)
        if cookie:
            return engine.SessionStore(cookie.value)
    return {}
