code: func ServerSupportsVersion(client DiscoveryInterface, requiredGV schema.GroupVersion) error {
  	groups, err := client.ServerGroups()
  	if err != nil {
  		// This is almost always a connection error, and higher level code should treat this as a generic error,
  		// not a negotiation specific error.
  		return err
  	}
  	versions := metav1.ExtractGroupVersions(groups)
  	serverVersions := sets.String{}
  	for _, v := range versions {
  		serverVersions.Insert(v)
  	}
  
  	if serverVersions.Has(requiredGV.String()) {
  		return nil
  	}
  
  	// If the server supports no versions, then we should pretend it has the version because of old servers.
  	// This can happen because discovery fails due to 403 Forbidden errors
  	if len(serverVersions) == 0 {
  		return nil
  	}
  
  	return fmt.Errorf("server does not support API version %q", requiredGV)
  }
docs: // ServerSupportsVersion returns an error if the server doesn't have the required version