code: func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
  	gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
  	if err != nil {
  		if IsNotRegisteredError(err) {
  			return e.Encoder.Encode(obj, stream)
  		}
  		return err
  	}
  	kind := obj.GetObjectKind()
  	oldGVK := kind.GroupVersionKind()
  	gvk := gvks[0]
  	if e.Version != nil {
  		preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
  		if ok {
  			gvk = preferredGVK
  		}
  	}
  	kind.SetGroupVersionKind(gvk)
  	err = e.Encoder.Encode(obj, stream)
  	kind.SetGroupVersionKind(oldGVK)
  	return err
  }
docs: // Encode does not do conversion. It sets the gvk during serialization.