<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_result(self, result):
 """Send back the result of this call. Only one of this and `write_exc_info` may be called. :param result: Return value of the call """

        assert not self.finished, "Already sent a response"

        if not self.result.thrift_spec:
            self.finished = True
            return

        spec = self.result.thrift_spec[0]
        if result is not None:
            assert spec, "Tried to return a result for a void method."
            setattr(self.result, spec[2], result)

        self.finished = True