code: def create_stdin_shell(shell, loop=None):
      
      @asyncio.coroutine
      def feed_stdin(loop, reader, shell):
          history = InMemoryHistory()
          completer = WordCompleter([name for name, _ in shell.get_commands()], ignore_case=True)
          while True:
              line = yield from prompt(
                  ">", patch_stdout=True, return_asyncio_coroutine=True, history=history, completer=completer)
              line += '\n'
              reader.feed_data(line.encode())
  
      @asyncio.coroutine
      def read_stdout(writer):
          while True:
              c = yield from writer.read(1)
              print(c.decode(), end='')
              sys.stdout.flush()
  
      reader = asyncio.StreamReader()
      writer = asyncio.StreamReader()
      shell.reader = reader
      shell.writer = writer
      if loop is None:
          loop = asyncio.get_event_loop()
  
      reader_task = loop.create_task(feed_stdin(loop, reader, shell))
      writer_task = loop.create_task(read_stdout(writer))
      shell_task = loop.create_task(shell.run())
      return asyncio.gather(shell_task, writer_task, reader_task)
docs: Run a shell application with a stdin frontend
  
      :param application: An EmbedShell instance
      :param loop: The event loop
      :returns: Telnet server