'.. warning::
Do not use the ``\'securecookie\'`` backend with
:class:`.providers.OpenID` provider. The
`python-openid`_ library saves **non json serializable** objects
to session which the ``\'securecookie\'`` backend cannot cope with.
:param handler:
A :class:`webapp2.RequestHandler` instance.
:param session:
A :class:`webapp2_extras.session.SessionDict` instance.
:param str secret:
The session secret.
:param str cookie_name:
The name of the session cookie.
:param backend:
The session backend. One of ``\'memcache\'`` or ``\'datastore\'``.
:param config:
The session config.'

def __init__(self, handler, session=None, secret=None, cookie_name='webapp2authomatic', backend='memcache', config=None):

    self.handler = handler
    if (session is None):
        if (not secret):
            raise GAEError('Either    session    or    secret    must    be    specified!')
        else:
            cfg = (config or dict(secret_key=secret, cookie_name=cookie_name))
            session_store = sessions.SessionStore(handler.request, cfg)
            self.session_dict = session_store.get_session(backend=backend)
    else:
        self.session_dict = session
