Converting either a Decimal or Binary value to Binary signed 2’s complement in Python

I am having trouble in achieving either of the following in Python: Convert a Decimal value to Binary signed 2’s complement. Examples: 40975 = 00000000000000001010000000001111 275 = 0000000100010011 Convert a Binary value to Binary signed 2’s complement. Examples: 1010000000001111 = 00000000000000001010000000001111 100010011 = 0000000100010011 Does anyone know of the easiest way of achieving this in…

Details