py: Use __hash__ method if a type defines it