class_docstr: Telnet interface class.
  
  An instance of this class represents a connection to a telnet
  server.  The instance is initially not connected; the open()
  method must be used to establish a connection.  Alternatively, the
  host name and optional port number can be passed to the
  constructor, too.
  
  Don't try to reopen an already connected instance.
  
  This class has many read_*() methods.  Note that some of them
  raise EOFError when the end of the connection is read, because
  they can return an empty string for other reasons.  See the
  individual doc strings.
  
  read_until(expected, [timeout])
      Read until the expected string has been seen, or a timeout is
      hit (default is no timeout); may block.
  
  read_all()
      Read all data until EOF; may block.
  
  read_some()
      Read at least one byte or EOF; may block.
  
  read_very_eager()
      Read all data available already queued or on the socket,
      without blocking.
  
  read_eager()
      Read either data already queued or some data available on the
      socket, without blocking.
  
  read_lazy()
      Read all data in the raw queue (processing it first), without
      doing any socket I/O.
  
  read_very_lazy()
      Reads all data in the cooked queue, without doing any socket
      I/O.
  
  read_sb_data()
      Reads available data between SB ... SE sequence. Don't block.
  
  set_option_negotiation_callback(callback)
      Each time a telnet option is read on the input flow, this callback
      (if set) is called with the following parameters :
      callback(telnet socket, command, option)
          option will be chr(0) when there is no option.
      No other action is done afterwards by telnetlib.
class_docstr_tok: ["Telnet","interface","class",".","An","instance","of","this","class","represents","a","connection","to","a","telnet","server",".","The","instance","is","initially","not","connected",";","the","open","(",")","method","must","be","used","to","establish","a","connection",".","Alternatively",",","the","host","name","and","optional","port","number","can","be","passed","to","the","constructor",",","too",".","Do","n't","try","to","reopen","an","already","connected","instance",".","This","class","has","many","read_","*","(",")","methods",".","Note","that","some","of","them","raise","EOFError","when","the","end","of","the","connection","is","read",",","because","they","can","return","an","empty","string","for","other","reasons",".","See","the","individual","doc","strings",".","read_until","(","expected",",","[","timeout","]",")","Read","until","the","expected","string","has","been","seen",",","or","a","timeout","is","hit","(","default","is","no","timeout",")",";","may","block",".","read_all","(",")","Read","all","data","until","EOF",";","may","block",".","read_some","(",")","Read","at","least","one","byte","or","EOF",";","may","block",".","read_very_eager","(",")","Read","all","data","available","already","queued","or","on","the","socket",",","without","blocking",".","read_eager","(",")","Read","either","data","already","queued","or","some","data","available","on","the","socket",",","without","blocking",".","read_lazy","(",")","Read","all","data","in","the","raw","queue","(","processing","it","first",")",",","without","doing","any","socket","I\/O",".","read_very_lazy","(",")","Reads","all","data","in","the","cooked","queue",",","without","doing","any","socket","I\/O",".","read_sb_data","(",")","Reads","available","data","between","SB","...","SE","sequence",".","Do","n't","block",".","set_option_negotiation_callback","(","callback",")","Each","time","a","telnet","option","is","read","on","the","input","flow",",","this","callback","(","if","set",")","is","called","with","the","following","parameters",":","callback","(","telnet","socket",",","command",",","option",")","option","will","be","chr","(","0",")","when","there","is","no","option",".","No","other","action","is","done","afterwards","by","telnetlib","."]
docstr: Connect to a host.
  
  The optional second argument is the port number, which
  defaults to the standard telnet port (23).
  
  Don't try to reopen an already connected instance.
docstr_tok: ["Connect","to","a","host",".","The","optional","second","argument","is","the","port","number",",","which","defaults","to","the","standard","telnet","port","(","23",")",".","Do","n't","try","to","reopen","an","already","connected","instance","."]
code: def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
      """Connect to a host.
  
      The optional second argument is the port number, which
      defaults to the standard telnet port (23).
  
      Don't try to reopen an already connected instance.
      """
      self.eof = 0
      if not port:
          port = TELNET_PORT
      self.host = host
      self.port = port
      self.timeout = timeout
      sys.audit("telnetlib.Telnet.open", self, host, port)
      self.sock = socket.create_connection((host, port), timeout)
  
imports: import sys
  import socket
  import selectors
  from time import monotonic
  import warnings
label_desc: Use image node_id 2 for calling the Telnet obj's underlying member method code with example usage: obj.open(host, port, timeout) without return types