

def 					__lowerCamelCase	( UpperCamelCase__      ):







							'''simple docstring'''






							return credit_card_number.startswith(('34', '35', '37', '4', '5', '6')      )





def 					__lowerCamelCase	( UpperCamelCase__      ):







							'''simple docstring'''






							snake_case_							=    credit_card_number
							snake_case_							=    0
							snake_case_							=    len(UpperCamelCase__      ) - 2
							for i in range(UpperCamelCase__   ,							-1   ,							-2      ):
														#  double the value of every second digit
														snake_case_							=    int(cc_number[i]      )
														digit *= 2
														# If doubling of a number results in a two digit number
														# i.e greater than 9(e.g., 6 × 2 = 12),
														# then add the digits of the product (e.g., 12: 1 + 2 = 3, 15: 1 + 5 = 6),
														# to get a single digit number.
														if digit > 9:
																					digit %= 10
																					digit += 1
														snake_case_							=    cc_number[:i] + str(UpperCamelCase__      ) + cc_number[i + 1 :]
														total += digit

							# Sum up the remaining digits
							for i in range(len(UpperCamelCase__      ) - 1   ,							-1   ,							-2      ):
														total += int(cc_number[i]      )

							return total % 10 == 0





def 					__lowerCamelCase	( UpperCamelCase__      ):







							'''simple docstring'''






							snake_case_							=    F'''{credit_card_number} is an invalid credit card number because'''
							if not credit_card_number.isdigit():
														print(F'''{error_message} it has nonnumerical characters.'''      )
														return False

							if not 13 <= len(UpperCamelCase__      ) <= 16:
														print(F'''{error_message} of its length.'''      )
														return False

							if not validate_initial_digits(UpperCamelCase__      ):
														print(F'''{error_message} of its first two digits.'''      )
														return False

							if not luhn_validation(UpperCamelCase__      ):
														print(F'''{error_message} it fails the Luhn check.'''      )
														return False

							print(F'''{credit_card_number} is a valid credit card number.'''      )
							return True


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					validate_credit_card_number("""4111111111111111""")
					validate_credit_card_number("""32323""")







import os

import numpy
import onnx





def 					__lowerCamelCase	( UpperCamelCase__   ,							UpperCamelCase__      ):







							'''simple docstring'''






							snake_case_							=    a.name
							snake_case_							=    b.name

							snake_case_							=    ''
							snake_case_							=    ''

							snake_case_							=    a == b

							snake_case_							=    name_a
							snake_case_							=    name_b

							return res





def 					__lowerCamelCase	( UpperCamelCase__   ,							UpperCamelCase__   ,							UpperCamelCase__      ):







							'''simple docstring'''






							for i, input_name in enumerate(node_proto.input      ):
														if input_name == name:
																					node_proto.input.insert(UpperCamelCase__   ,							UpperCamelCase__      )
																					node_proto.input.pop(i + 1      )

							if node_proto.op_type == "If":
														_graph_replace_input_with(node_proto.attribute[0].g   ,							UpperCamelCase__   ,							UpperCamelCase__      )
														_graph_replace_input_with(node_proto.attribute[1].g   ,							UpperCamelCase__   ,							UpperCamelCase__      )
							if node_proto.op_type == "Loop":
														_graph_replace_input_with(node_proto.attribute[0].g   ,							UpperCamelCase__   ,							UpperCamelCase__      )





def 					__lowerCamelCase	( UpperCamelCase__   ,							UpperCamelCase__   ,							UpperCamelCase__      ):







							'''simple docstring'''






							for n in graph_proto.node:
														_node_replace_input_with(UpperCamelCase__   ,							UpperCamelCase__   ,							UpperCamelCase__      )





def 					__lowerCamelCase	( UpperCamelCase__   ,							UpperCamelCase__   ,							UpperCamelCase__      ):







							'''simple docstring'''






							snake_case_							=    list(model.graph.initializer      )
							snake_case_							=    list(model_without_ext.graph.initializer      )
							for i, ref_i in ind_to_replace:
														assert inits_with_data[i].name == inits[i].name
														assert inits_with_data[ref_i].name == inits[ref_i].name
														assert i > ref_i

														snake_case_							=    inits[i].name
														snake_case_							=    inits[ref_i].name

														model_without_ext.graph.initializer.remove(inits[i]      )

														# for n in model.graph.node:
														_graph_replace_input_with(model_without_ext.graph   ,							UpperCamelCase__   ,							UpperCamelCase__      )





def 					__lowerCamelCase	( UpperCamelCase__      ):







							'''simple docstring'''






							snake_case_							=    os.path.dirname(UpperCamelCase__      )
							snake_case_							=    os.path.basename(UpperCamelCase__      )

							snake_case_							=    onnx.load(os.path.join(UpperCamelCase__   ,							UpperCamelCase__      )      )

							snake_case_							=    list(model.graph.initializer      )

							snake_case_							=    set()
							snake_case_							=    {}
							snake_case_							=    []

							snake_case_							=    0

							for i in range(len(UpperCamelCase__      )      ):
														if i in dup_set:
																					continue

														for j in range(i + 1   ,							len(UpperCamelCase__      )      ):
																					if j in dup_set:
																												continue
																					if _is_equal_tensor_proto(inits[i]   ,							inits[j]      ):
																												dup_set.add(UpperCamelCase__      )
																												dup_set.add(UpperCamelCase__      )

																												snake_case_							=    inits[j].data_type
																												snake_case_							=    numpy.prod(inits[j].dims      )
																												if dtype == 1:
																																			mem_size *= 4
																												elif dtype == 6:
																																			mem_size *= 4
																												elif dtype == 7 or dtype == 11:
																																			mem_size *= 8
																												else:
																																			print('unexpected data type: '   ,							UpperCamelCase__      )
																												total_reduced_size += mem_size

																												snake_case_							=    inits[i].name
																												snake_case_							=    inits[j].name

																												if name_i in dup_map:
																																			dup_map[name_i].append(UpperCamelCase__      )
																												else:
																																			snake_case_							=    [name_j]
																												ind_to_replace.append((j, i)      )

							print('total reduced size: '   ,							total_reduced_size / 1024 / 1024 / 1024   ,							'GB'      )

							snake_case_							=    sorted(UpperCamelCase__      )
							_remove_dup_initializers_from_model(UpperCamelCase__   ,							UpperCamelCase__   ,							UpperCamelCase__      )

							snake_case_							=    'optimized_' + model_file_name
							snake_case_							=    os.path.join(UpperCamelCase__   ,							UpperCamelCase__      )
							onnx.save(UpperCamelCase__   ,							UpperCamelCase__      )

							return new_model




