def getEncodableAttributes(self, obj, codec=None):
        attrs = pyamf.ClassAlias.getEncodableAttributes(self, obj, codec=codec)

        gae_objects = getGAEObjects(codec.context) if codec else None

        if self.reference_properties and gae_objects:
            for name, prop in self.reference_properties.iteritems():
                klass = prop.reference_class
                key = prop.get_value_for_datastore(obj)

                if not key:
                    continue

                try:
                    attrs[name] = gae_objects.getClassKey(klass, key)
                except __HOLE__:
                    ref_obj = getattr(obj, name)
                    gae_objects.addClassKey(klass, key, ref_obj)
                    attrs[name] = ref_obj

        for k in attrs.keys()[:]:
            if k.startswith('_'):
                del attrs[k]

        for attr in obj.dynamic_properties():
            attrs[attr] = getattr(obj, attr)

        if not self.no_key_attr:
            attrs[self.KEY_ATTR] = str(obj.key()) if obj.is_saved() else None

        return attrs
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/adapters/_google_appengine_ext_db.py/DataStoreClassAlias.getEncodableAttributes