def delete_user_sessions(user):
    """Delete all active user sessions.

    :param user: User instance.
    :returns: If ``True`` then the session is successfully deleted.
    """
    with db.session.begin_nested():
        for s in user.active_sessions:
            _sessionstore.delete(s.sid_s)

        SessionActivity.query.filter_by(user=user).delete()

    return True
def delete_user_sessions ( user ) : with db . session . begin_nested ( ) : for s in user . active_sessions : _sessionstore . delete ( s . sid_s ) SessionActivity . query . filter_by ( user = user ) . delete ( ) return True
Delete all active user sessions.

    :param user: User instance.
    :returns: If ``True`` then the session is successfully deleted.