def confirm(question, options, default="y"):
    # type: (str, List[str], str) -> str
    """Takes a question (string), list of options and a default value (used
    when user simply hits enter).
    Asks until valid option is entered.
    """
    # Highlight default option with [ ]
    options_chunks = []
    for x in options:
        if x == default:
            x = "[%s]" % x
        if x != "":
            options_chunks.append(x)
    options_str = "/".join(options_chunks)

    while True:
        print(question)
        print("(%s) " % (options_str), end="")
        try:
            ans = input().strip()
        except KeyboardInterrupt as errormsg:
            print("\n", errormsg)
            raise UserAbort(errormsg)

        if ans in options:
            return ans
        elif ans == "":
            return default
Takes a question (string), list of options and a default value (used
    when user simply hits enter).
    Asks until valid option is entered.
    
tvnamer/main.py