title: How to get the instance type of an Exception?
body: <p>I have this code:</p>
  
  <pre><code>try:
      self.client.post(url, data, self.cookies, headers, auth, jsonrpc)
      self.status  = self.client.status
      self.mytime  = self.client.time
      self.text    = self.client.text
      self.length  = len(self.text)
  except urllib2.URLError, error:
      print error
      self.exception = True
      self.urrlib2   = True
      if isinstance(error.reason, socket.timeout):
          self.timeout = True
  </code></pre>
  
  <p>But sometimes I get exceptions printing out like this:</p>
  
  <pre><code>URLError in POST &gt; reason=The read operation timed out &gt; &lt;urlopen error The read operation timed out&gt;
  </code></pre>
  
  <p>These are handled by the <code>except urllib2.URLError</code>. They should pass the <code>if isinstance(error.reason, socket.timeout)</code> test, but they do not.</p>
  
  <p>So I would like to know what <code>instance</code> this exception is. How can I do this?</p>