def load_confirm_exit_bindings(python_input: PythonInput) -> KeyBindings:
    """
    Handle yes/no key presses when the exit confirmation is shown.
    """
    bindings = KeyBindings()

    handle = bindings.add
    confirmation_visible = Condition(lambda: python_input.show_exit_confirmation)

    @handle("y", filter=confirmation_visible)
    @handle("Y", filter=confirmation_visible)
    @handle("enter", filter=confirmation_visible)
    @handle("c-d", filter=confirmation_visible)
    def _(event: E) -> None:
        """
        Really quit.
        """
        event.app.exit(exception=EOFError, style="class:exiting")

    @handle(Keys.Any, filter=confirmation_visible)
    def _(event: E) -> None:
        """
        Cancel exit.
        """
        python_input.show_exit_confirmation = False
        python_input.app.layout.focus_previous()

    return bindings

    Handle yes/no key presses when the exit confirmation is shown.
    
src/ptpython/key_bindings.py