I saw the following code that converts unsigned number to 2's complement. Never seen this kind of syntax before.
seems like a condensed if/else but I am unable to look it up in google cuz i don't know its name.
def core(x,N):
x = int(x)
return (x + (0,-2**N) [x >= 2**(N-1)])