<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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 = []