

def _choose_formatting_pattern_for_number(available_formats, national_number):
    for num_format in available_formats:
        size = len(num_format.leading_digits_pattern)
        if (size > 0):
            ld_pattern = re.compile(num_format.leading_digits_pattern[(- 1)])
            ld_match = available_formats.match(national_number)
        if ((size == 0) or ld_match):
            format_pattern = re.compile(num_format.pattern)
            if fullmatch(format_pattern, national_number):
                return num_format
    return None

dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py _choose_formatting_pattern_for_number/VarMisuse@56/91 `ld_pattern`->`available_formats`