Add bit_length emulator for python < 2.7