def boundary(value, minvalue, maxvalue):
 return min(max(value, minvalue), maxvalue)

def boundary ( value , minvalue , maxvalue ) : return min ( max ( value , minvalue ) , maxvalue )
limit a value between a minvalue and maxvalue .