def is_possible_number_with_reason(numobj):
    """Check whether a phone number is a possible number.

    It provides a more lenient check than is_valid_number() in the following
    sense:

     - It only checks the length of phone numbers. In particular, it doesn't
       check starting digits of the number.

     - It doesn't attempt to figure out the type of the number, but uses
       general rules which applies to all types of phone numbers in a
       region. Therefore, it is much faster than is_valid_number.

     - For fixed line numbers, many regions have the concept of area code,
       which together with subscriber number constitute the national
       significant number. It is sometimes okay to dial the subscriber number
       only when dialing in the same area. This function will return true if
       the subscriber-number-only version is passed in. On the other hand,
       because is_valid_number validates using information on both starting
       digits (for fixed line numbers, that would most likely be area codes)
       and length (obviously includes the length of area codes for fixed line
       numbers), it will return false for the subscriber-number-only version.

    Arguments:
    numobj -- The number object that needs to be checked

    Returns a value from ValidationResult which indicates whether the number
    is possible
    """
    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)
dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py/is_possible_number_with_reason/original