#NEWLINE# def sendline( self , cmd ) : #NEWLINE# #INDENT# '\n        Send this command to the server and\n        return a tuple of the output and the stderr.\n\n        The format for parameters is:\n\n        cmd (string): The command to send to the sever.\n        ' #NEWLINE# self . conn . sendline ( cmd , self . linesep ) #NEWLINE# ret_stdout = [ ] #NEWLINE# ret_stderr = [ ] #NEWLINE# while self . conn . has_unread_data : #NEWLINE# #INDENT# ( stdout , stderr ) = self . conn . recv ( ) #NEWLINE# if stdout : #NEWLINE# #INDENT# ret_stdout . append ( stdout ) #NEWLINE# #UNINDENT# if stderr : #NEWLINE# #INDENT# log . debug ( 'Error while executing command.' ) #NEWLINE# ret_stderr . append ( stderr ) #NEWLINE# #UNINDENT# if ( stdout and self . prompt_re . search ( stdout ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return ( '' . join ( ret_stdout ) , '' . join ( ret_stderr ) )