def throttle(self, key, amount=1, rate=None, capacity=None,
            exc_class=Throttled, **kwargs):
        """Consume an amount for a given key, or raise a Throttled exception."""

        if not self.consume(key, amount, rate, capacity, **kwargs):
            raise exc_class("Request of %d unit for %s exceeds capacity."
                    % (amount, key))
Consume an amount for a given key, or raise a Throttled exception.