def user_input_validator(validator, question):  # pragma: no cover
    """Validate a user input until it passes a validator function.

    validator: function, test for user input. Returns a truthy
               value for a valid input, falsey for invalid.
    question: str, prompt for user to answer
    """
    user_input = input(question).upper()

    while not validator(user_input) and user_input.upper() != 'Q':
        print('Invalid user input, input again\n')
        user_input = input(question).upper()
    return user_input