def format_national_number_with_carrier_code(numobj, carrier_code):
 country_code = numobj.country_code
 nsn = national_significant_number(numobj)
 if (not _has_valid_country_calling_code(country_code)):
  return nsn
 region_code = region_code_for_country_code(country_code)
 metadata = PhoneMetadata.metadata_for_region_or_calling_code(country_code, region_code)
 formatted_number = _format_nsn(nsn, metadata, PhoneNumberFormat.NATIONAL, carrier_code)
 formatted_number = _maybe_append_formatted_extension(numobj, metadata, PhoneNumberFormat.NATIONAL, formatted_number)
 formatted_number = _prefix_number_with_country_calling_code(country_code, PhoneNumberFormat.NATIONAL, formatted_number)
 return formatted_number

def format_national_number_with_carrier_code ( numobj , carrier_code ) : country_code = numobj . country_code nsn = national_significant_number ( numobj ) if ( not _has_valid_country_calling_code ( country_code ) ) : return nsn region_code = region_code_for_country_code ( country_code ) metadata = PhoneMetadata . metadata_for_region_or_calling_code ( country_code , region_code ) formatted_number = _format_nsn ( nsn , metadata , PhoneNumberFormat . NATIONAL , carrier_code ) formatted_number = _maybe_append_formatted_extension ( numobj , metadata , PhoneNumberFormat . NATIONAL , formatted_number ) formatted_number = _prefix_number_with_country_calling_code ( country_code , PhoneNumberFormat . NATIONAL , formatted_number ) return formatted_number
format a number in national format for dialing using the specified carrier .