

def _format_original_allow_mods(numobj, region_calling_from):
    if (numobj.country_code_source == CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN):
        return format_number(numobj, PhoneNumberFormat.INTERNATIONAL)
    elif (numobj.country_code_source == CountryCodeSource.FROM_NUMBER_WITH_IDD):
        return format_out_of_country_calling_number(numobj, region_calling_from)
    elif (numobj.country_code_source == CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN):
        return format_number(numobj, PhoneNumberFormat.INTERNATIONAL)[1:]
    else:
        region_code = region_code_for_country_code(numobj.country_code)
        national_prefix = ndd_prefix_for_region(region_code, True)
        national_format = format_number(numobj, PhoneNumberFormat.NATIONAL)
        if ((national_prefix is None) or (len(national_prefix) == 0)):
            return national_format
        if _raw_input_contains_national_prefix(numobj.raw_input, national_prefix, region_code):
            return national_format
        metadata = PhoneMetadata.metadata_for_region(region_code)
        national_number = national_significant_number(numobj)
        format_rule = _choose_formatting_pattern_for_number(metadata.number_format, national_number)
        if (format_rule is None):
            return national_format
        candidate_national_prefix_rule = format_rule.national_prefix_formatting_rule
        if (candidate_national_prefix_rule is None):
            return national_format
        index_of_first_group = candidate_national_prefix_rule.find('\\1')
        if (index_of_first_group <= 0):
            return national_format
        candidate_national_prefix_rule = candidate_national_prefix_rule[:index_of_first_group]
        candidate_national_prefix_rule = normalize_digits_only(candidate_national_prefix_rule)
        if (len(candidate_national_prefix_rule) == 0):
            return national_format
        new_format_rule = _copy_number_format(format_rule)
        new_format_rule.national_prefix_formatting_rule = None
        return format_by_pattern(numobj, PhoneNumberFormat.NATIONAL, [new_format_rule])

dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py _format_original_allow_mods/original