def get_maxrate(ratelimits, size):
 last_func = None
 if size:
  size = int(size)
  for (ratesize, rate, func) in ratelimits:
   if (size < ratesize):
    break
   last_func = func
  if last_func:
   return last_func(size)
 return None

def get_maxrate ( ratelimits , size ) : last_func = None if size : size = int ( size ) for ( ratesize , rate , func ) in ratelimits : if ( size < ratesize ) : break last_func = func if last_func : return last_func ( size ) return None
returns number of requests allowed per second for given size .