Returns a :class:`~defer.Deferred` that will be called back
        with the value of the next event.

def next_event(self, canceller=None):
        """
        Returns a :class:`~defer.Deferred` that will be called back
        with the value of the next event.
        """
        d = defer.Deferred(canceller)
        
        def cb(value):
            self.remove_callback(d.callback)
            return value
        d.addBoth(cb)
        
        self.add_callback(d.callback)
        return d