def __eq__(self, other):
    if other.__class__ is not self.__class__:
      return NotImplemented
    if self._key != other._key:
      # TODO: If one key is None and the other is an explicit
      # incomplete key of the simplest form, this should be OK.
      return False
    return self._equivalent(other)
Compare two entities of the same class for equality.
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py/Model.__eq__