If you want to get an inversion of only first 16 bits of a number, you can take a xor of that number with 65535(16 1s in binary). Forgetting a 2s complement, just add one to the result. For example,
Example
a = 3 # 11 in binary b = (a ^ 65535) + 1 print(bin(b))
Output
This will give the output:
0b1111111111111101