code: func NewYAMLEncoder(groupName string) (runtime.Encoder, error) {
  	// encode to YAML
  	mediaType := "application/yaml"
  	info, ok := runtime.SerializerInfoForMediaType(legacyscheme.Codecs.SupportedMediaTypes(), mediaType)
  	if !ok {
  		return nil, fmt.Errorf("unsupported media type %q", mediaType)
  	}
  
  	versions := legacyscheme.Scheme.PrioritizedVersionsForGroup(groupName)
  	if len(versions) == 0 {
  		return nil, fmt.Errorf("no enabled versions for group %q", groupName)
  	}
  
  	// the "best" version supposedly comes first in the list returned from legacyscheme.Registry.EnabledVersionsForGroup
  	return legacyscheme.Codecs.EncoderForVersion(info.Serializer, versions[0]), nil
  }
docs: // NewYAMLEncoder generates a new runtime.Encoder that encodes objects to YAML