def set_session(self, user, token=None, token_ts=None, cache_ts=None, remember=False, **session_args):
    'Saves a user in the session.\n\n        :param user:\n            A dictionary with user data.\n        :param token:\n            A unique token to be persisted. If None, a new one is created.\n        :param token_ts:\n            Token timestamp. If None, a new one is created.\n        :param cache_ts:\n            Token cache timestamp. If None, a new one is created.\n        :remember:\n            If True, session is set to be persisted.\n        :param session_args:\n            Keyword arguments to set the session arguments.\n        '
    now = int(time.time())
    token = (token or self.store.create_auth_token(user['user_id']))
    token_ts = (token_ts or now)
    cache_ts = (cache_ts or now)
    if remember:
        max_age = self.store.config['token_max_age']
    else:
        max_age = None
    session_args.setdefault('max_age', max_age)
    user.update({'token': token, 'token_ts': token_ts, 'cache_ts': cache_ts, 'remember': int(remember)})
    self.set_session_data(user, **session_args)
    self._user = user
Saves a user in the session.

:param user:
    A dictionary with user data.
:param token:
    A unique token to be persisted. If None, a new one is created.
:param token_ts:
    Token timestamp. If None, a new one is created.
:param cache_ts:
    Token cache timestamp. If None, a new one is created.
:remember:
    If True, session is set to be persisted.
:param session_args:
    Keyword arguments to set the session arguments.
def set_session(self, user, token=None, token_ts=None, cache_ts=None, remember=False, **session_args):
    'Saves a user in the session.\n\n        :param user:\n            A dictionary with user data.\n        :param token:\n            A unique token to be persisted. If None, a new one is created.\n        :param token_ts:\n            Token timestamp. If None, a new one is created.\n        :param cache_ts:\n            Token cache timestamp. If None, a new one is created.\n        :remember:\n            If True, session is set to be persisted.\n        :param session_args:\n            Keyword arguments to set the session arguments.\n        '
    now = int(time.time())
    token = (token or self.store.create_auth_token(user['user_id']))
    token_ts = (token_ts or now)
    cache_ts = (cache_ts or now)
    if remember:
        max_age = self.store.config['token_max_age']
    else:
        max_age = None
    session_args.setdefault('max_age', max_age)
    user.update({'token': token, 'token_ts': token_ts, 'cache_ts': cache_ts, 'remember': int(remember)})
    self.set_session_data(user, **session_args)
    self._user = user