def toggle_bit(value, bit):
return value ^ <NUM_LIT:1> << bit<EOL>
>>> toggle_bit(128, 7)
0
>>> toggle_bit(0, 7)
128

>>> '{0:08b}'.format(toggle_bit(int('11111111', 2), bit=5))
'11011111'
>>> '{0:08b}'.format(toggle_bit(int('11011111', 2), bit=5))
'11111111'

>>> '{0:08b}'.format(toggle_bit(int('1111000011110000', 2), bit=13))
'1101000011110000'
>>> '{0:08b}'.format(toggle_bit(int('1101000011110000', 2), bit=13))
'1111000011110000'