#NEWLINE# def get_connection( socket , endpoint , ssh_server = None , ssh_keyfile = None ) : #NEWLINE# #INDENT# if ( ssh_server is None ) : #NEWLINE# #INDENT# socket . connect ( ssh_server ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ssh . tunnel_connection ( socket , endpoint , ssh_server , keyfile = ssh_keyfile ) #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# ssh . tunnel_connection ( socket , endpoint , ssh_server , keyfile = ssh_keyfile , paramiko = True ) #NEWLINE# #UNINDENT# #UNINDENT# except ImportError : #NEWLINE# #INDENT# raise ImportError ( 'pexpect was not found, and failed to use Paramiko.  You need to install Paramiko' )