def validate_digits_input(message, values_range=None):
    """
    Checks users input to be only numbers else it will be in infinite loop for a right value.
    Extra parameter 'values_range' checks the input to be between a range.
    """
    input_number = None
    while True:
        jarvis.output_engine.assistant_response(message)
        user_input = jarvis.input_engine.recognize_input(already_activated=True)
        try:
            input_number = int(user_input)
        except ValueError:
            continue

        if values_range:
            min_value = values_range[0]
            max_value = values_range[1]
            if not min_value <= input_number <= max_value:
                jarvis.output_engine.assistant_response\
                    ("Please give a number higher/equal than {0} and smaller/equal than {1}".format(min_value, max_value))
                raise ValueError
            else:
                break
    return input_number
Checks users input to be only numbers else it will be in infinite loop for a right value.
Extra parameter 'values_range' checks the input to be between a range.
src/jarvis/jarvis/utils/input.py