

def truncate_too_long_number(numobj):
    'Truncate a number object that is too long.\n\n    Attempts to extract a valid number from a phone number that is too long\n    to be valid, and resets the PhoneNumber object passed in to that valid\n    version. If no valid number could be extracted, the PhoneNumber object\n    passed in will not be modified.\n\n    Arguments:\n    numobj -- A PhoneNumber object which contains a number that is too long to\n              be valid.\n\n    Returns True if a valid phone number can be successfully extracted.\n    '
    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.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

dataset/ETHPy150Open daviddrysdale/python-phonenumbers/python/phonenumbers/phonenumberutil.py truncate_too_long_number/VarMisuse@62/291 `numobj_copy`->`numobj`