'Get the number of tokens in bucket'

def get(self):

    now = time.time()
    if (self.bucket >= self.burst):
        self.last_update = now
        return self.bucket
    bucket = (self.rate * (now - self.last_update))
    self.mutex.acquire()
    if (bucket > 1):
        self.bucket += bucket
        if (self.bucket > self.burst):
            self.bucket = self.burst
        self.last_update = now
    self.mutex.release()
    return self.bucket
