cara membatalkan input dalam python

def timed_input(seconds, print_if_failed, prompt, what_to_type):

    timer = Timer(seconds, print, [print_if_failed])
    timer.start()
    print(prompt)
    answer = input()
    if answer.lower() == what_to_type.lower() and timer.is_alive():
        timer.cancel()
        return True
    else:
        return False
Calm Caracal