def _raise_connection_failure(address, error):
 (host, port) = address
 if (port is not None):
  msg = ('%s:%d: %s' % (host, port, error))
 else:
  msg = ('%s: %s' % (host, error))
 if isinstance(error, socket.timeout):
  raise NetworkTimeout(msg)
 elif (isinstance(error, SSLError) and ('timed out' in str(error))):
  raise NetworkTimeout(msg)
 else:
  raise AutoReconnect(msg)

def _raise_connection_failure ( address , error ) : ( host , port ) = address if ( port is not None ) : msg = ( '%s:%d: %s' % ( host , port , error ) ) else : msg = ( '%s: %s' % ( host , error ) ) if isinstance ( error , socket . timeout ) : raise NetworkTimeout ( msg ) elif ( isinstance ( error , SSLError ) and ( 'timed out' in str ( error ) ) ) : raise NetworkTimeout ( msg ) else : raise AutoReconnect ( msg )
convert a socket .