'Gets a formatting template which can be used to efficiently
format a partial number where digits are added one by one.'

def _get_formatting_template(self, number_pattern, number_format):

    longest_phone_number = unicod('999999999999999')
    number_re = re.compile(number_pattern)
    m = number_re.search(longest_phone_number)
    a_phone_number = m.group(0)
    if (len(a_phone_number) < len(self._national_number)):
        return U_EMPTY_STRING
    template = re.sub(number_pattern, number_format, a_phone_number)
    template = re.sub('9', _DIGIT_PLACEHOLDER, template)
    return template
