def str_input(prompt="", max_length=0):
    """Uses `input(prompt)` to request a str value from the user, retrying if the user doesn't enter anything or
    only enters whitespace.

     @param str prompt: The prompt to display.
     @param int max_length: The maximum length of the string. Defaults to no length limit.
     @return str: The entered value.
    """

    while True:
        string = input(prompt)
        if not len(string.strip()):
            continue
        if max_length != 0 and len(string) > max_length:
            print("Your text is too long. It must not exceed a length of %i characters." % max_length)
        return string