Token bucket implementation for rate limiting.
Token Bucket Algorithm.
See http://en.wikipedia.org/wiki/Token_Bucket Most of this code was stolen from an entry in the ASPN Python Cookbook: http://code.activestate.com/recipes/511490/
Thread safety
This implementation may not be thread safe.
Return True if the number of tokens can be consumed from the bucket.
Maximum number of tokens in the bucket.
Return the time (in seconds) when a new token is expected to be available.
This will also consume a token from the bucket.
The rate in tokens/second that the bucket will be refilled.
Timestamp of the last time a token was taken out of the bucket.