'Wait for thread to exit and return the result or raise an exception.
:rtype: any'

def wait_for_result(self):

    (result, exception) = self._result.get()
    if exception:
        if (sys.version_info[0] > 2):
            raise exception[1].with_traceback(exception[2])
        exec 'raise    exception[0],    exception[1],    exception[2]'
    return result
