from typing import Optional


def prompt_string(prompt_msg: str,
                  error_msg: Optional[str] = "Input not valid.") -> str:
    """Prompts the user for input, repeating until input is provided."""

    input_data: str = input(prompt_msg)
    while len(input_data.strip()) == 0:
        print(error_msg)
        input_data: str = input(prompt_msg)
    return input_data