'Return the result for this request.
If block is True, wait until the result has arrived or *timeout* seconds passes.
If the timeout is reached, raise NoResultError. (use timeout=None to disable)
If block is False, raise NoResultError immediately if the result has not arrived yet.
If the process\'s connection has closed before the result arrives, raise ClosedError.'

def result(self, block=True, timeout=None):

    if self.gotResult:
        return self._result
    if (timeout is None):
        timeout = self.timeout
    if block:
        start = time.time()
        while (not self.hasResult()):
            if self.proc.exited:
                raise ClosedError()
            time.sleep(0.005)
            if ((timeout >= 0) and ((time.time() - start) > timeout)):
                print ('Request    timed    out:    %s' % self.description)
                import traceback
                traceback.print_stack()
                raise NoResultError()
        return self._result
    else:
        self._result = self.proc.getResult(self.reqId)
        self.gotResult = True
        return self._result
