title: get_pty() via sshClient sometimes hangs forever with paramiko
body: <p>In an automation script, i need to ssh into several servers to gather some data. Unfortunately, few of them seems to have intermittent issues where the connection hangs forever on get_pty().</p>
  
  <p>Here's a snippet of my code. Is there something I can do to kill the connection? I'm using python of course, and unfortunately with python, there is no easy way to kill a thread either :( </p>
  
  <pre><code>client = paramiko.SSHClient()
  client.load_system_host_keys()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  connect(hostname, port=port, username=username, password=password, timeout=30)
  self.__chan = self.__client.get_transport().open_session()
  print self.__chan
  print ' after'
  print self.__chan.get_pty()
  </code></pre>
  
  <p>output</p>
  
  <pre><code>&lt;paramiko.Channel 1 (open) window=0 -&gt; &lt;paramiko.Transport at 0xd49410L (cipher aes128-ctr, 128 bits) (active; 1 open channel(s))&gt;&gt;
   after
  </code></pre>
  
  <p>I believe the issue has to do with a failed attempt to get_transport() or open_session() properly. If so, how can i detect if an issue occurred?</p>