class_docstr:     Telnet server implementation.
  
      Example::
  
          async def interact(connection):
              connection.send("Welcome")
              session = PromptSession()
              result = await session.prompt_async(message="Say something: ")
              connection.send(f"You said: {result}
  ")
  
          async def main():
              server = TelnetServer(interact=interact, port=2323)
              await server.run()
      
code: def __init__(
      self,
      host: str = "127.0.0.1",
      port: int = 23,
      interact: Callable[
          [TelnetConnection], Coroutine[Any, Any, None]
      ] = _dummy_interact,
      encoding: str = "utf-8",
      style: BaseStyle | None = None,
      enable_cpr: bool = True,
  ) -> None:
      self.host = host
      self.port = port
      self.interact = interact
      self.encoding = encoding
      self.style = style
      self.enable_cpr = enable_cpr
  
      self._run_task: asyncio.Task[None] | None = None
      self._application_tasks: list[asyncio.Task[None]] = []
  
      self.connections: set[TelnetConnection] = set()
  
imports: from __future__ import annotations
  import asyncio
  import contextvars
  import socket
  from asyncio import get_running_loop
  from typing import Any, Callable, Coroutine, TextIO, cast
  from prompt_toolkit.application.current import create_app_session, get_app
  from prompt_toolkit.application.run_in_terminal import run_in_terminal
  from prompt_toolkit.data_structures import Size
  from prompt_toolkit.formatted_text import AnyFormattedText, to_formatted_text
  from prompt_toolkit.input import PipeInput, create_pipe_input
  from prompt_toolkit.output.vt100 import Vt100_Output
  from prompt_toolkit.renderer import print_formatted_text
  from prompt_toolkit.styles import BaseStyle, DummyStyle
  from .log import logger
  from .protocol import DO, ECHO, IAC, LINEMODE, MODE, NAWS, SB, SE, SEND, SUPPRESS_GO_AHEAD, TTYPE, WILL, TelnetProtocolParser
label_desc: Use image node_id 1 to create a new TelnetServer object  with example: obj = TelnetServer(host, port, interact, encoding, style, enable_cpr)