Help me to understand this code

Hi!
I would love if someone would explain what this code exactly does.

def xor(x, y):
if x:
if y:
return False
return True
return True

I believe that it returns true if x is true, and false if y is false…But it’s strange and doesn’t make any sense to me :S
Thanks!

If x is True and y is True it returns False as given.

If x is False there is no action, only the return, which is True

If x is True and y is False then the return is True, as given.

def xor(x, y):
     if x:
         if y:
             return False
        return True
    return True