I would like to represent an negative integer in bits, using two's complement representation. Using standard Python bit representation utilities doesn't help much:
>>> bin(-5)
'-0b101'
>>> format(-5, 'b')
'-101'
-5
in two's complement is represented as 1011
. How do I do this?