Here's an example of an easy and compact way to simuate the trinary operator in python. It is not short circuit like the one in C, but it is pretty simple:
newowner = [self.newowner, None][self.contactid == self.newowner]
This will set newowner to self.newowner if self.contactid is not the same as self.newowner. Otherwise it will set it to None.