The result of the jobs execution. Accessing this property while the job is
    pending or running will raise #InvalidState. If an exception occured during
    the jobs execution, it will be raised.

    # Raises
    InvalidState: If the job is not in state #FINISHED.
    Cancelled: If the job was cancelled.
    any: If an exception ocurred during the job's execution.

def result(self):
    """
    The result of the jobs execution. Accessing this property while the job is
    pending or running will raise #InvalidState. If an exception occured during
    the jobs execution, it will be raised.

    # Raises
    InvalidState: If the job is not in state #FINISHED.
    Cancelled: If the job was cancelled.
    any: If an exception ocurred during the job's execution.
    """

    if self.__cancelled:
      raise Job.Cancelled
    elif self.__state in (Job.PENDING, Job.RUNNING):
      raise Job.InvalidState('job is {0}'.format(self.__state))
    elif self.__state == Job.ERROR:
      reraise(*self.__exception)
    elif self.__state == Job.SUCCESS:
      return self.__result
    else:
      raise RuntimeError('invalid job state {0!r}'.format(self.__state))