Returns the exception value by the future's worker or :const:`None`.

    :param timeout:
    :param do_raise:
    :param Cancelled:
    :param Timeout:
    :return: :const:`None` or an exception value.

def exception(self, timeout=None, do_raise=True):
    """
    Returns the exception value by the future's worker or :const:`None`.

    :param timeout:
    :param do_raise:
    :param Cancelled:
    :param Timeout:
    :return: :const:`None` or an exception value.
    """

    with self._lock:
      self.wait(timeout, do_raise=do_raise)
      if not self._exc_info:
        return None
      self._exc_retrieved = True
      if self._cancelled:
        raise self.Cancelled()
      return self._exc_info[1]