<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_state(self, state):
 """Save a state doc to the LRS :param state: State document to be saved :type state: :class:`tincan.documents.state_document.StateDocument` :return: LRS Response object with saved state as content :rtype: :class:`tincan.lrs_response.LRSResponse` """

        request = HTTPRequest(
            method="PUT",
            resource="activities/state",
            content=state.content,
        )
        if state.content_type is not None:
            request.headers["Content-Type"] = state.content_type
        else:
            request.headers["Content-Type"] = "application/octet-stream"

        if state.etag is not None:
            request.headers["If-Match"] = state.etag

        request.query_params = {
            "stateId": state.id,
            "activityId": state.activity.id,
            "agent": state.agent.to_json(self.version)
        }
        lrs_response = self._send_request(request)
        lrs_response.content = state

        return self._send_request(request)