code: func (f *PrintFlags) ToPrinter() (printers.ResourcePrinter, error) {
  	outputFormat := ""
  	if f.OutputFormat != nil {
  		outputFormat = *f.OutputFormat
  	}
  
  	noHeaders := false
  	if f.NoHeaders != nil {
  		noHeaders = *f.NoHeaders
  	}
  	f.HumanReadableFlags.NoHeaders = noHeaders
  	f.CustomColumnsFlags.NoHeaders = noHeaders
  
  	// for "get.go" we want to support a --template argument given, even when no --output format is provided
  	if f.TemplateFlags.TemplateArgument != nil && len(*f.TemplateFlags.TemplateArgument) > 0 && len(outputFormat) == 0 {
  		outputFormat = "go-template"
  	}
  
  	if p, err := f.TemplateFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
  		return p, err
  	}
  
  	if f.TemplateFlags.TemplateArgument != nil {
  		f.CustomColumnsFlags.TemplateArgument = *f.TemplateFlags.TemplateArgument
  	}
  
  	if p, err := f.JSONYamlPrintFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
  		return p, err
  	}
  
  	if p, err := f.HumanReadableFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
  		return p, err
  	}
  
  	if p, err := f.CustomColumnsFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
  		return p, err
  	}
  
  	if p, err := f.NamePrintFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
  		return p, err
  	}
  
  	return nil, genericclioptions.NoCompatiblePrinterError{OutputFormat: &outputFormat, AllowedFormats: f.AllowedFormats()}
  }
docs: // ToPrinter attempts to find a composed set of PrintFlags suitable for
  // returning a printer based on current flag values.