def telnet_connect(ip_addr):
 try:
  return telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT)
 except socket.timeout:
  sys.exit('Connection timed-out')

def telnet_connect ( ip_addr ) : try : return telnetlib . Telnet ( ip_addr , TELNET_PORT , TELNET_TIMEOUT ) except socket . timeout : sys . exit ( 'Connection timed-out' )
establish telnet connection .