<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_config(self, config):
 """Sends TraceConfig to the agent and gets agent's config in reply. :type config: `~opencensus.proto.trace.v1.TraceConfig` :param config: Trace config with sampling and other settings :rtype: `~opencensus.proto.trace.v1.TraceConfig` :returns: Trace config from agent. """


        # do not allow updating config simultaneously
        lock = Lock()
        with lock:
            # TODO: keep the stream alive.
            # The stream is terminated after iteration completes.
            # To keep it alive, we can enqueue proto configs here
            # and asyncronously read them and send to the agent.
            config_responses = self.client.Config(
                self.generate_config_request(config))

            agent_config = next(config_responses)
            return agent_config