code: func writeKubeConfigFromSpec(out io.Writer, spec *kubeConfigSpec, clustername string) error {
  
  	// builds the KubeConfig object
  	config, err := buildKubeConfigFromSpec(spec, clustername)
  	if err != nil {
  		return err
  	}
  
  	// writes the kubeconfig to disk if it not exists
  	configBytes, err := clientcmd.Write(*config)
  	if err != nil {
  		return errors.Wrap(err, "failure while serializing admin kubeconfig")
  	}
  
  	fmt.Fprintln(out, string(configBytes))
  	return nil
  }
docs: // writeKubeConfigFromSpec creates a kubeconfig object from a kubeConfigSpec and writes it to the given writer.