def get_scale(x):
 scales = [20, 50, 100, 200, 400, 600, 800, 1000]
 for scale in scales:
  if (x <= scale):
   return scale
 return x

def get_scale ( x ) : scales = [ 20 , 50 , 100 , 200 , 400 , 600 , 800 , 1000 ] for scale in scales : if ( x <= scale ) : return scale return x
finds the lowest scale where x <= scale .