@total_ordering
class One:

    def __lt__(self, other):
        if not isinstance(other, type(self)):
            return NotImplemented
return self.attrOne < other.attrOne

def __eq__(self, other):
    if not isinstance(other, type(self)):
        return NotImplemented
return self.attrOne == other.attrOne
Get the object with the max attribute's value in a list of objects