def is_possible_number_with_reason(numobj):
    national_number = national_significant_number(numobj)
    country_code = numobj.country_code
    # Note: For Russian Fed and NANPA numbers, we just use the rules from the
    # default region (US or Russia) since the region_code_for_number() will
    # not work if the number is possible but not valid. This would need to be
    # revisited if the possible number pattern ever differed between various
    # regions within those plans.
    if not _has_valid_country_calling_code(country_code):
        return ValidationResult.INVALID_COUNTRY_CODE
    region_code = region_code_for_country_code(country_code)
    # Metadata cannot be None because the country calling code is valid.
    metadata = PhoneMetadata.metadata_for_region_or_calling_code(country_code, region_code)
    possible_re = re.compile(metadata.general_desc.possible_number_pattern or U_EMPTY_STRING)
    return _test_number_length_against_pattern(possible_re, national_number)
Check whether a phone number is a possible number.
dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py/is_possible_number_with_reason