title: Python telnet read a long output issue
body: <p>Here is my telnet script as:</p>
  
  <pre><code>import sys
  import getpass
  import telnetlib
  import time
  
  HOST = "192.168.182.129"
  
  user = input("Enter your remote  telnet account: ")
  password = getpass.getpass()
  
  tn = telnetlib.Telnet(HOST)
  
  tn.read_until(b"Username: ")
  tn.write(user.encode('ascii') + b"\n")
  if password:
   tn.read_until(b"Password: ")
   tn.write(password.encode('ascii') + b"\n")
  
  tn.write(b"show version\n")
  time.sleep(5)
  tn.write(b"config t\n")
  time.sleep(2)
  tn.write(b"interface loopback 1\n")
  time.sleep(2)
  tn.write(b"ip address 8.8.8.8 255.255.255.0\n")
  tn.write(b"end\n")
  tn.write(b"exit\n")
  
  print(tn.read_all().decode('ascii'))
  </code></pre>
  
  <p>Here, If I am using some long output command as "Show Version" then this script is not working as wanted and it will show only few lines of output and also cut the next command as:</p>
  
  <pre><code>Enter your remote  telnet account: deepak
  Password:
  
  R1#show version
  Cisco IOS Software, 7200 Software (C7200-ADVIPSERVICESK9-M), Version 15.2(4)S5, RELEASE SOFTWARE (fc1)
  Technical Support: http://www.cisco.com/techsupport
  Copyright (c) 1986-2014 by Cisco Systems, Inc.
  Compiled Thu 20-Feb-14 06:51 by prod_rel_team
  
  ROM: ROMMON Emulation Microcode
  BOOTLDR: 7200 Software (C7200-ADVIPSERVICESK9-M), Version 15.2(4)S5, RELEASE SOFTWARE (fc1)
  
  R1 uptime is 2 hours, 16 minutes
  System returned to ROM by unknown reload cause - suspect boot_data[BOOT_COUNT] 0x0, BOOT_COUNT 0, BOOTDATA 19
  System image file is "tftp://255.255.255.255/unknown"
  Last reload reason: Unknown reason
  
  
  
  This product contains cryptographic features and is subject to United
  States and local country laws governing import, export, transfer and
  use. Delivery of Cisco cryptographic products does not imply
  third-party authority to import, export, distribute or use encryption.
  Importers, exporters, **distributors and users are responsible for**
  
  **R1#onfig t**
  
  % Invalid input detected at '^' marker.
  
  R1#interface loopback 1
  
  % Invalid input detected at '^' marker.
  
  R1#ip address 8.8.8.8 255.255.255.0
  
  % Invalid input detected at '^' marker.
  
  R1#end
  </code></pre>
  
  <p>Looking your help for the same. </p>