def wait_for_task(task):
 task_done = False
 while (not task_done):
  if (task.info.state == 'success'):
   return task.info.result
  if (task.info.state == 'error'):
   print 'there was an error'
   task_done = True

def wait_for_task ( task ) : task_done = False while ( not task_done ) : if ( task . info . state == 'success' ) : return task . info . result if ( task . info . state == 'error' ) : print 'there was an error' task_done = True
wait for a vcenter task to finish .