def release(self):
        """
        Release the token.

        Should be called by whoever did the L{acquire}() when the shared
        resource is free.
        """
        assert self.tokens < self.limit, "Someone released me too many times: too many tokens!"
        self.tokens = self.tokens + 1
        if self.waiting:
            # someone is waiting to acquire token
            self.tokens = self.tokens - 1
            d = self.waiting.pop(0)
            d.callback(self)

        Release the token.

        Should be called by whoever did the L{acquire}() when the shared
        resource is free.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/defer.py