def ratelimit_sleep(running_time, max_rate, incr_by=1, rate_buffer=5):
 if ((max_rate <= 0) or (incr_by <= 0)):
  return running_time
 clock_accuracy = 1000.0
 now = (time.time() * clock_accuracy)
 time_per_request = (clock_accuracy * (float(incr_by) / max_rate))
 if ((now - running_time) > (rate_buffer * clock_accuracy)):
  running_time = now
 elif ((running_time - now) > time_per_request):
  eventlet.sleep(((running_time - now) / clock_accuracy))
 return (running_time + time_per_request)

def ratelimit_sleep ( running_time , max_rate , incr_by = 1 , rate_buffer = 5 ) : if ( ( max_rate <= 0 ) or ( incr_by <= 0 ) ) : return running_time clock_accuracy = 1000.0 now = ( time . time ( ) * clock_accuracy ) time_per_request = ( clock_accuracy * ( float ( incr_by ) / max_rate ) ) if ( ( now - running_time ) > ( rate_buffer * clock_accuracy ) ) : running_time = now elif ( ( running_time - now ) > time_per_request ) : eventlet . sleep ( ( ( running_time - now ) / clock_accuracy ) ) return ( running_time + time_per_request )
will eventlet .