code: def _initialize_telnet(connection: socket.socket) -> None:
      logger.info("Initializing telnet connection")
  
      # Iac Do Linemode
      connection.send(IAC + DO + LINEMODE)
  
      # Suppress Go Ahead. (This seems important for Putty to do correct echoing.)
      # This will allow bi-directional operation.
      connection.send(IAC + WILL + SUPPRESS_GO_AHEAD)
  
      # Iac sb
      connection.send(
          IAC + SB + LINEMODE + MODE + int2byte(0) + IAC + SE
      )
  
      # IAC Will Echo
      connection.send(IAC + WILL + ECHO)
  
      # Negotiate window size
      connection.send(IAC + DO + NAWS)
  
      # Negotiate terminal type
      # Assume the client will accept the negotiation with `IAC +  WILL + TTYPE`
      connection.send(IAC + DO + TTYPE)
  
      # We can then select the first terminal type supported by the client,
      # which is generally the best type the client supports
      # The client should reply with a `IAC + SB  + TTYPE + IS + ttype + IAC + SE`
      connection.send(IAC + SB + TTYPE + SEND + IAC + SE)
  
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 2 for calling a global function with example usage: _initialize_telnet(connection) without return types