#NEWLINE# def wait_for_task( self , task ) : #NEWLINE# #INDENT# 'Waits for the given task to complete and returns the result.\n\n        The task is polled until it is done. The method returns the task\n        information upon successful completion. In case of any error,\n        appropriate exception is raised.\n\n        :param task: managed object reference of the task\n        :returns: task info upon successful completion of the task\n        :raises: VimException, VimFaultException, VimAttributeException,\n                 VimSessionOverLoadException, VimConnectionException\n        ' #NEWLINE# loop = loopingcall . FixedIntervalLoopingCall ( self . _poll_task , task ) #NEWLINE# evt = loop . start ( self . _task_poll_interval ) #NEWLINE# LOG . debug ( 'Waiting for the task: %s to complete.' , task ) #NEWLINE# return evt . wait ( )