Is it possible to telnet to a server and from there telnet to another server in python?
Since there is a controller which I telnet into using a username and password, and from the controller command line I need to login as root to run linux command. How would I do that using python? 
I use the telentlib to login into router controller but from the router controller I need to log in again to get into shell. Is this possible using python?
Thanks!
Just checked it with the hardware I have in hand & telnetlib. Saw no problem.
When you are connected to the first device just send all the necessary commands using telnet.write('cmd'). It may be sudo su\n, telnet 192.168.0.2\n or whatever else. Telnetlib keeps in mind only its own telnet connection, all secondary connections are handled by the corresponding controllers.
Telnet from telnet session in python