code: func GetSubresourcesForVersion(crd *CustomResourceDefinition, version string) (*CustomResourceSubresources, error) {
  	if !HasPerVersionSubresources(crd.Spec.Versions) {
  		return crd.Spec.Subresources, nil
  	}
  	if crd.Spec.Subresources != nil {
  		return nil, fmt.Errorf("malformed CustomResourceDefinition %s version %s: top-level and per-version subresources must be mutual exclusive", crd.Name, version)
  	}
  	for _, v := range crd.Spec.Versions {
  		if version == v.Name {
  			return v.Subresources, nil
  		}
  	}
  	return nil, fmt.Errorf("version %s not found in CustomResourceDefinition: %v", version, crd.Name)
  }
docs: // GetSubresourcesForVersion returns the subresources for given version or nil.