def __eq__(self, other): if not isinstance(other, (Message, Mapping)): return NotImplemented return dict(ItemsView(self)) == dict(ItemsView(other))