<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_agent_profile(self, profile):
 """Save an agent profile doc to the LRS :param profile: Agent profile doc to be saved :type profile: :class:`tincan.documents.agent_profile_document.AgentProfileDocument` :return: LRS Response object with the saved agent profile doc as content :rtype: :class:`tincan.lrs_response.LRSResponse` """

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

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

        request.query_params = {
            "profileId": profile.id,
            "agent": profile.agent.to_json(self.version)
        }
        lrs_response = self._send_request(request)
        lrs_response.content = profile

        return lrs_response