def wait(self, timeout=None):
    """
    Waits for the job to finish and returns the result.

    # Arguments
    timeout (number, None): A number of seconds to wait for the result
      before raising a #Timeout exception.

    # Raises
    Timeout: If the timeout limit is exceeded.
    """

    def cond(self):
      return self.__state not in (Job.PENDING, Job.RUNNING) or self.__cancelled
    if not wait_for_condition(self, cond, timeout):
      raise Job.Timeout
    return self.result
def wait ( self , timeout = None ) : def cond ( self ) : return self . __state not in ( Job . PENDING , Job . RUNNING ) or self . __cancelled if not wait_for_condition ( self , cond , timeout ) : raise Job . Timeout return self . result
Waits for the job to finish and returns the result.

    # Arguments
    timeout (number, None): A number of seconds to wait for the result
      before raising a #Timeout exception.

    # Raises
    Timeout: If the timeout limit is exceeded.