code: func asVersionedObject(infos []*resource.Info, forceList bool, specifiedOutputVersion schema.GroupVersion, encoder runtime.Encoder) (runtime.Object, error) {
  	objects, err := asVersionedObjects(infos, specifiedOutputVersion, encoder)
  	if err != nil {
  		return nil, err
  	}
  
  	var object runtime.Object
  	if len(objects) == 1 && !forceList {
  		object = objects[0]
  	} else {
  		object = &api.List{Items: objects}
  		targetVersions := []schema.GroupVersion{}
  		if !specifiedOutputVersion.Empty() {
  			targetVersions = append(targetVersions, specifiedOutputVersion)
  		}
  		targetVersions = append(targetVersions, schema.GroupVersion{Group: "", Version: "v1"})
  
  		converted, err := tryConvert(scheme.Scheme, object, targetVersions...)
  		if err != nil {
  			return nil, err
  		}
  		object = converted
  	}
  
  	actualVersion := object.GetObjectKind().GroupVersionKind()
  	if actualVersion.Version != specifiedOutputVersion.Version {
  		defaultVersionInfo := ""
  		if len(actualVersion.Version) > 0 {
  			defaultVersionInfo = fmt.Sprintf("Defaulting to %q", actualVersion.Version)
  		}
  		klog.V(1).Infof("info: the output version specified is invalid. %s\n", defaultVersionInfo)
  	}
  	return object, nil
  }
docs: // asVersionedObject converts a list of infos into a single object - either a List containing
  // the objects as children, or if only a single Object is present, as that object. The provided
  // version will be preferred as the conversion target, but the Object's mapping version will be
  // used if that version is not present.