def wait( self, timeout = -<NUM_LIT:1> ):
<EOL>if self.numberOfPendingResults() > <NUM_LIT:0>:<EOL><INDENT>timeWaited = <NUM_LIT:0><EOL>while (timeout < <NUM_LIT:0>) or (timeWaited < timeout):<EOL><INDENT>if self.numberOfPendingResults() == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>if timeout == -<NUM_LIT:1>:<EOL><INDENT>dt = self.WaitingTime<EOL><DEDENT>else:<EOL><INDENT>if (timeout - timeWaited) < self.WaitingTime:<EOL><INDENT>dt = timeout - timeWaited<EOL><DEDENT>else:<EOL><INDENT>dt = self.WaitingTime<EOL><DEDENT><DEDENT>time.sleep(dt)<EOL>timeWaited = timeWaited + dt<EOL><DEDENT><DEDENT>return (self.numberOfPendingResults() == <NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Wait for all pending results to be finished. If timeout is set,
        return after this many seconds regardless.

        :param timeout: timeout period in seconds (defaults to forever)
        :returns: True if all the results completed