Use urlparse to decode url's used to specify the connection. This is simpler and gets its right much more often.
When a telnet url is passed on the command line, honour that request and use telnet to connect, not ssh.
Amalgamate parse_ssh_url and parse_telnet_url into parse_url.
Parse_url now returns the scheme specified in the url so we can use that find which connection method to use.
Use socket.getservbyname() to get the port to use based on the scheme.
Put credits in for code that's come from stackoverfkow.
Allow underscores in hostnames.