code: func IsValid(given string) bool {
  	_, err := ForComparison(given)
  	return err == nil
  }
docs: // IsValid returns true if the given user-specified hostname is a valid
  // service hostname.
  //
  // Validity is determined by complying with the RFC 5891 requirements for
  // names that are valid for domain lookup (section 5), with the additional
  // requirement that user-supplied forms must not _already_ contain
  // Punycode segments.