def truncate_too_long_number(numobj):
 if is_valid_number(numobj):
  return True
 numobj_copy = PhoneNumber()
 numobj_copy.merge_from(numobj)
 national_number = numobj.national_number
 while (not is_valid_number(numobj_copy)):
  national_number = (national_number // 10)
  numobj_copy.national_number = national_number
  validation_result = is_possible_number_with_reason(numobj_copy)
  if ((validation_result == ValidationResult.TOO_SHORT) or (national_number == 0)):
   return False
 numobj.national_number = national_number
 return True

def truncate_too_long_number ( numobj ) : if is_valid_number ( numobj ) : return True numobj_copy = PhoneNumber ( ) numobj_copy . merge_from ( numobj ) national_number = numobj . national_number while ( not is_valid_number ( numobj_copy ) ) : national_number = ( national_number // 10 ) numobj_copy . national_number = national_number validation_result = is_possible_number_with_reason ( numobj_copy ) if ( ( validation_result == ValidationResult . TOO_SHORT ) or ( national_number == 0 ) ) : return False numobj . national_number = national_number return True
truncate a number object that is too long .