def __hash__(self):
return hash(frozenset(self.__dict__.keys()))<EOL>
If we define __eq__ we also need __hash__ otherwise the object
becomes unhashable. All this does is hash the frozenset of the
keys. (You can only hash immutables.)