def METHOD_NAME(self, session_id=None, action=None):
    """Change session.
    **Example request**:
    .. sourcecode:: http
        PATCH /api/v1/sessions/1/activate HTTP/1.1
        X-Requested-With: XMLHttpRequest
    **Example response**:
    .. sourcecode:: http
        HTTP/1.1 200 OK
        Content-Type: application/json
        {
            "status": "success",
            "data": null
        }
    """
    target_id = self.get_argument("target_id", None)
    if (session_id is None) or (target_id is None and action in ["add", "remove"]):
        raise APIError(400, "Incorrect query parameters")
    try:
        if action == "add":
            add_target_to_session(self.session, int(self.get_argument("target_id")), session_id=int(session_id))
        elif action == "remove":
            remove_target_from_session(
                self.session, int(self.get_argument("target_id")), session_id=int(session_id)
            )
        elif action == "activate":
            Session.set_by_id(self.session, int(session_id))
        self.success(None)
    except exceptions.InvalidTargetReference:
        raise APIError(400, "Invalid target reference provided")
    except exceptions.InvalidSessionReference:
        raise APIError(400, "Invalid parameter type provided")