':param int tokens: Size of bucket
:param rate: Amount of time to accrue 1 token. Either `timedelta` or interval string.
:param bool wait: If true, will wait for a token to be available. If false, errors when token is not available.'

def __init__(self, domain, tokens, rate, wait=True):

    super(TokenBucketLimiter, self).__init__(domain)
    self.max_tokens = tokens
    self.rate = parse_timedelta(rate)
    self.wait = wait
    self.state = self.state_cache.setdefault(domain, {u'tokens': self.max_tokens, u'last_update': datetime.now()})
