code: def _assign_parent(self, ctx):
          
          def _assign(cls, _, obj):
              if obj == None:
                  return
  
              if cls.is_produced(obj):
                  if isinstance(obj, BaseObj):
                      obj._parent__ = self
              else:
                  raise ValueError('Object is not instance of {0} but {1}'.format(cls.__swagger_ref_object__.__name__, obj.__class__.__name__))
  
          # set self as childrent's parent
          for name, (ct, ctx) in six.iteritems(ctx.__swagger_child__):
              obj = getattr(self, name)
              if obj == None:
                  continue
  
              container_apply(ct, obj, functools.partial(_assign, ctx))
docs: parent assignment, internal usage only