def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
 candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
 if (numobj.extension is not None):
  candidate_number_group_index = (len(candidate_groups) - 2)
 else:
  candidate_number_group_index = (len(candidate_groups) - 1)
 if ((len(candidate_groups) == 1) or (candidate_groups[candidate_number_group_index].find(national_significant_number(numobj)) != (-1))):
  return True
 formatted_number_group_index = (len(formatted_number_groups) - 1)
 while ((formatted_number_group_index > 0) and (candidate_number_group_index >= 0)):
  if (candidate_groups[candidate_number_group_index] != formatted_number_groups[formatted_number_group_index]):
   return False
  formatted_number_group_index -= 1
  candidate_number_group_index -= 1
 return ((candidate_number_group_index >= 0) and candidate_groups[candidate_number_group_index].endswith(formatted_number_groups[0]))

def _all_number_groups_are_exactly_present ( numobj , normalized_candidate , formatted_number_groups ) : candidate_groups = re . split ( NON_DIGITS_PATTERN , normalized_candidate ) if ( numobj . extension is not None ) : candidate_number_group_index = ( len ( candidate_groups ) - 2 ) else : candidate_number_group_index = ( len ( candidate_groups ) - 1 ) if ( ( len ( candidate_groups ) == 1 ) or ( candidate_groups [ candidate_number_group_index ] . find ( national_significant_number ( numobj ) ) != ( - 1 ) ) ) : return True formatted_number_group_index = ( len ( formatted_number_groups ) - 1 ) while ( ( formatted_number_group_index > 0 ) and ( candidate_number_group_index >= 0 ) ) : if ( candidate_groups [ candidate_number_group_index ] != formatted_number_groups [ formatted_number_group_index ] ) : return False formatted_number_group_index -= 1 candidate_number_group_index -= 1 return ( ( candidate_number_group_index >= 0 ) and candidate_groups [ candidate_number_group_index ] . endswith ( formatted_number_groups [ 0 ] ) )
returns true if the groups of digits found in our candidate phone number match our expectations .