@classmethod
    @postonly
    @multiplayer_service
    @jsonify
    def leave(cls):
        params = request.params
        try:
            session_id = params['session']
            player_id = params['player']
            _ = params['gameSessionId'] # Check for compatibility with gamesite API which does use this
        except KeyError:
            response.status_int = 400
            return {'ok': False, 'msg': 'Missing session information.'}

        sessions = cls.sessions
        try:
            session = sessions[session_id]
        except __HOLE__:
            response.status_int = 404
            return {'ok': False, 'msg': 'Unknown session.'}

        with cls.lock:

            if session.has_player(player_id):

                request_ip = get_remote_addr(request)

                stored_ip = session.get_player_ip(player_id)
                if stored_ip is not None and request_ip != stored_ip:
                    response.status_int = 401
                    return {'ok': False}

                LOG.info('Player %s leaving session %s', player_id, session_id)

                session.remove_player(player_id)

                cls._clean_empty_sessions()

        return {'ok': True}
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/controllers/apiv1/multiplayer.py/MultiplayerController.leave