code: def retrieve_state(self, activity, agent, state_id, registration=None):
          
          if not isinstance(activity, Activity):
              activity = Activity(activity)
  
          if not isinstance(agent, Agent):
              agent = Agent(agent)
  
          request = HTTPRequest(
              method="GET",
              resource="activities/state",
              ignore404=True
          )
  
          request.query_params = {
              "activityId": activity.id,
              "agent": agent.to_json(self.version),
              "stateId": state_id
          }
  
          if registration is not None:
              request.query_params["registration"] = registration
  
          lrs_response = self._send_request(request)
  
          if lrs_response.success:
              doc = StateDocument(
                  id=state_id,
                  content=lrs_response.data,
                  activity=activity,
                  agent=agent
              )
              if registration is not None:
                  doc.registration = registration
  
              headers = lrs_response.response.getheaders()
              if "lastModified" in headers and headers["lastModified"] is not None:
                  doc.timestamp = headers["lastModified"]
              if "contentType" in headers and headers["contentType"] is not None:
                  doc.content_type = headers["contentType"]
              if "etag" in headers and headers["etag"] is not None:
                  doc.etag = headers["etag"]
  
              lrs_response.content = doc
  
          return lrs_response
docs: Retrieve state from LRS with the provided parameters
  
          :param activity: Activity object of desired state
          :type activity: :class:`tincan.activity.Activity`
          :param agent: Agent object of desired state
          :type agent: :class:`tincan.agent.Agent`
          :param state_id: UUID of desired state
          :type state_id: str | unicode
          :param registration: registration UUID of desired state
          :type registration: str | unicode
          :return: LRS Response object with retrieved state document as content
          :rtype: :class:`tincan.lrs_response.LRSResponse`