

def _maybe_strip_i18n_prefix_and_normalize(number, possible_idd_prefix):
    'Strips any international prefix (such as +, 00, 011) present in the\n    number provided, normalizes the resulting number, and indicates if an\n    international prefix was present.\n\n    Arguments:\n    number -- The non-normalized telephone number that we wish to strip any international\n              dialing prefix from.\n    possible_idd_prefix -- The international direct dialing prefix from the region we\n              think this number may be dialed in.\n\n    Returns a 2-tuple containing:\n      - The corresponding CountryCodeSource if an international dialing prefix\n        could be removed from the number, otherwise\n        CountryCodeSource.FROM_DEFAULT_COUNTRY if the number did not seem to\n        be in international format.\n      - The number with the prefix stripped.\n    '
    if (len(number) == 0):
        return (CountryCodeSource.FROM_DEFAULT_COUNTRY, number)
    m = _PLUS_CHARS_PATTERN.match(number)
    if m:
        number = number[m.end():]
        return (CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN, _normalize(number))
    idd_pattern = re.compile(possible_idd_prefix)
    number = _normalize(number)
    (stripped, number) = _parse_prefix_as_idd(idd_pattern, number)
    if stripped:
        return (CountryCodeSource.FROM_NUMBER_WITH_IDD, number)
    else:
        return (CountryCodeSource.FROM_DEFAULT_COUNTRY, number)

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