'Called by the CollectorIterator object to retrieve the
result\'s values one after another, in the order the results have
become available.
\param idx The index of the result we want, wrt collector\'s order
\param timeout integer telling how long to wait (in seconds)
for the result at index idx to be available, or None (wait
forever)'

def _get_result(self, idx, timeout=None):

    self._cond.acquire()
    try:
        if (idx >= self._expected):
            raise IndexError
        elif (idx < len(self._collection)):
            return self._collection[idx]
        elif (idx != len(self._collection)):
            raise IndexError()
        else:
            self._cond.wait(timeout=timeout)
            try:
                return self._collection[idx]
            except IndexError:
                raise TimeoutError('Timeout    while    waiting    for    results')
    finally:
        self._cond.release()
