Use math.ceil()
to round float values up:
import math
def roundTo32(x, base=32):
return int(base * math.ceil(float(x) / base))
Demo:
>>> import math
>>> def roundTo32(x, base=32):
... return int(base * math.ceil(float(x) / base))
...
>>> roundTo32(15)
32
>>> roundTo32(33)
64