speed up Python object calculation of 2**N