def __eq__(self, other):
    """Common `__eq__` implementation for classes which has `__slots__`."""
    if self.__class__ is not other.__class__:
        return False
    return all(getattr(self, attr) == getattr(other, attr)
               for attr in self.__slots__)