'Update remaining requests based on the elapsed time since
they were last calculated.'

def _update_remaining(self):

    if (self.remaining_requests is None):
        self.remaining_requests = float(limit_requests)
    else:
        since_last_call = (time.time() - self.last_call)
        self.remaining_requests += (since_last_call * (limit_requests / limit_interval))
        self.remaining_requests = min(self.remaining_requests, float(limit_requests))
    self.last_call = time.time()
