Fulfill the promise with a given value.

def fulfill(self, value):
        """
        Fulfill the promise with a given value.
        """

        assert self._state==self.PENDING

        self._state=self.FULFILLED;
        self.value = value
        for callback in self._callbacks:
            try:
                callback(value)
            except Exception:
                # Ignore errors in callbacks
                pass
        # We will never call these callbacks again, so allow
        # them to be garbage collected.  This is important since
        # they probably include closures which are binding variables
        # that might otherwise be garbage collected.
        self._callbacks = []