'Attempts to set the formatting template and returns a string which
contains the formatted version of the digits entered so far.'

def _attempt_to_choose_formatting_pattern(self):

    if (len(self._national_number) >= _MIN_LEADING_DIGITS_LENGTH):
        self._get_available_formats(self._national_number)
        formatted_number = self._attempt_to_format_accrued_digits()
        if (len(formatted_number) > 0):
            return formatted_number
        if self._maybe_create_new_template():
            return self._input_accrued_national_number()
        else:
            return self._accrued_input
    else:
        return self._append_national_number(self._national_number)
