def wait_for_task(task, actionName='job', hideResult=False):
    
    while task.info.state == vim.TaskInfo.State.running:
        time.sleep(2)
    
    if task.info.state == vim.TaskInfo.State.success:
        if task.info.result is not None and not hideResult:
            out = '%s completed successfully, result: %s' % (actionName, task.info.result)
            print out
        else:
            out = '%s completed successfully.' % actionName
            print out
    else:
        out = '%s did not complete successfully: %s' % (actionName, task.info.error)
        raise task.info.error
        print out
    
    return task.info.result
Construct a ZipFile or ContextualZipFile as appropriate
dataset/ETHPy150Open rreubenur/vmware-pyvmomi-examples/network_configure.py/wait_for_task--crossover with--dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/pkg_resources/__init__.py/ContextualZipFile.__new__