def _CopyFromEntity(self, entity):
    if entity.__class__ != self.__class__:
      raise TypeError('Can only copy from entities of the exact type %s. '
                      'Received an instance of %s.' %
                      (self.__class__.__name__, entity.__class__.__name__))

    for prop in entity._EndpointsPropertyItervalues():
      # The name of the attr on the model/object, may differ
      # from the name of the property
      attr_name = prop._code_name

      value = getattr(entity, attr_name)
      if value is not None:
        # Only overwrite null values
        if isinstance(prop, EndpointsAliasProperty):
          value_set = getattr(self, attr_name) is not None
        else:
          value_set = prop._name in self._values
        if not value_set:
          setattr(self, attr_name, value)
Tests that if an app is in SHARED_APPS, it does not get synced to
dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/endpoints_proto_datastore/ndb/model.py/EndpointsModel._CopyFromEntity--crossover with--dataset/ETHPy150Open tomturner/django-tenants/django_tenants/tests/test_tenants.py/TenantSyncTest.test_shared_apps_does_not_sync_tenant_apps