code: func (c *ClientCache) ClientConfigForVersion(version *unversioned.GroupVersion) (*client.Config, error) {
  	if c.defaultConfig == nil {
  		config, err := c.loader.ClientConfig()
  		if err != nil {
  			return nil, err
  		}
  		c.defaultConfig = config
  		if c.matchVersion {
  			if err := client.MatchesServerVersion(c.defaultClient, config); err != nil {
  				return nil, err
  			}
  		}
  	}
  	if version != nil {
  		if config, ok := c.configs[*version]; ok {
  			return config, nil
  		}
  	}
  
  	// TODO: have a better config copy method
  	config := *c.defaultConfig
  
  	// TODO these fall out when we finish the refactor
  	var preferredGV *unversioned.GroupVersion
  	if version != nil {
  		versionCopy := *version
  		preferredGV = &versionCopy
  	}
  
  	negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, preferredGV, registered.EnabledVersions())
  	if err != nil {
  		return nil, err
  	}
  	config.GroupVersion = negotiatedVersion
  	client.SetKubernetesDefaults(&config)
  
  	if version != nil {
  		c.configs[*version] = &config
  	}
  
  	// `version` does not necessarily equal `config.Version`.  However, we know that we call this method again with
  	// `config.Version`, we should get the the config we've just built.
  	configCopy := config
  	c.configs[*config.GroupVersion] = &configCopy
  
  	return &config, nil
  }
docs: // ClientConfigForVersion returns the correct config for a server