def open(self, host=None, port=<NUM_LIT:0>, socket_file=None, <EOL>timeout=socket.getdefaulttimeout()):
self.socket_file = socket_file<EOL>if host is not None:<EOL><INDENT>if sys.version_info[:<NUM_LIT:2>] >= (<NUM_LIT:2>,<NUM_LIT:6>):<EOL><INDENT>telnetlib.Telnet.open(self, host, port, timeout)<EOL><DEDENT>else:<EOL><INDENT>telnetlib.Telnet.open(self, host, port)<EOL><DEDENT><DEDENT>elif socket_file is not None:<EOL><INDENT>self.eof = <NUM_LIT:0><EOL>self.host = host<EOL>self.port = port<EOL>self.timeout = timeout<EOL>self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)<EOL>self.sock.settimeout(timeout)<EOL>self.sock.connect(socket_file)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>
Connect to a host.

        With a host argument, it connects the instance using TCP; port number 
        and timeout are optional, socket_file must be None. The port number
        defaults to the standard telnet port (23).

        With a socket_file argument, it connects the instance using
        named socket; timeout is optional and host must be None.

        Don't try to reopen an already connected instance.