code: func maybeAppendFormattedExtension(
  	number *PhoneNumber,
  	metadata *PhoneMetadata,
  	numberFormat PhoneNumberFormat,
  	formattedNumber *builder.Builder) {
  
  	extension := number.GetExtension()
  	if len(extension) == 0 {
  		return
  	}
  
  	prefExtn := metadata.GetPreferredExtnPrefix()
  	if numberFormat == RFC3966 {
  		formattedNumber.WriteString(RFC3966_EXTN_PREFIX)
  	} else if len(prefExtn) > 0 {
  		formattedNumber.WriteString(prefExtn)
  	} else {
  		formattedNumber.WriteString(DEFAULT_EXTN_PREFIX)
  	}
  	formattedNumber.WriteString(extension)
  }
docs: // Appends the formatted extension of a phone number to formattedNumber,
  // if the phone number had an extension specified.