sessions.py: pep8 + put deferred as argument

This commit transfers the deferred used in request using an argument
of the function, instead of relying on the dynamic state of the scope
of the functions.