The Python builtin function bin() gives the binary literal form of an integer. But Python uses 2's complement inside for integers. This module provide bin2() to produce 2's complement form of an integer.
>>> from bin2 import bin2
>>> bin2(-5)
0b1011