class LinkedKeyProperty(ndb.KeyProperty):

    def _fix_up(self, cls, code_name):
        super(LinkedKeyProperty, self)._fix_up(cls, code_name)
modelclass = ndb.Model._kind_map[self._kind]
Following backreferences of unknown kinds in NDB