def interactive_shell():
    """
    Coroutine that shows the interactive command line.
    """
    # Create interface. (style/layout is only for demonstration.)
    cli = CommandLineInterface(
        layout=Layout(before_input=DefaultPrompt(text='Say something inside the event loop: ')),
        style=TestStyle)

    # Patch stdout in something that will always print *above* the prompt when
    # something is written to stdout.
    sys.stdout = cli.stdout_proxy()

    # Run echo loop. Read text from stdin, and reply it back.
    while True:
        try:
            result = yield from cli.read_input_async(
                on_exit=AbortAction.RAISE_EXCEPTION,
                on_abort=AbortAction.RAISE_EXCEPTION)
            print('You said: "%s"' % result.text)
        except (Exit, Abort):
            loop.stop()
            print('Qutting event loop. Bye.')
            return