#NEWLINE# def _request( self , op ) : #NEWLINE# #INDENT# 'Implementations of :meth:`request` call this method to send the request and process the reply.\n\n        In synchronous mode, blocks until the reply is received and returns :class:`RPCReply`. Depending on the :attr:`raise_mode` a `rpc-error` element in the reply may lead to an :exc:`RPCError` exception.\n\n        In asynchronous mode, returns immediately, returning `self`. The :attr:`event` attribute will be set when the reply has been received (see :attr:`reply`) or an error occured (see :attr:`error`).\n\n        *op* is the operation to be requested as an :class:`~xml.etree.ElementTree.Element`\n        ' #NEWLINE# logger . info ( ( 'Requesting %r' % self . __class__ . __name__ ) ) #NEWLINE# req = self . _wrap ( op ) #NEWLINE# self . _session . send ( req ) #NEWLINE# if self . _async : #NEWLINE# #INDENT# logger . debug ( 'Async request, returning %r' , self ) #NEWLINE# return self #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . debug ( ( 'Sync request, will wait for timeout=%r' % self . _timeout ) ) #NEWLINE# self . _event . wait ( self . _timeout ) #NEWLINE# if self . _event . isSet ( ) : #NEWLINE# #INDENT# if self . _error : #NEWLINE# #INDENT# raise self . _error #NEWLINE# #UNINDENT# self . _reply . parse ( ) #NEWLINE# if ( ( self . _reply . error is not None ) and ( not self . _device_handler . is_rpc_error_exempt ( self . _reply . error . message ) ) ) : #NEWLINE# #INDENT# if ( ( self . _raise_mode == RaiseMode . ALL ) or ( ( self . _raise_mode == RaiseMode . ERRORS ) and ( self . _reply . error . severity == 'error' ) ) ) : #NEWLINE# #INDENT# errlist = [ ] #NEWLINE# errors = self . _reply . errors #NEWLINE# if ( len ( errors ) > 1 ) : #NEWLINE# #INDENT# raise RPCError ( to_ele ( self . _reply . _raw ) , errs = errors ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise self . _reply . error #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if self . _device_handler . transform_reply ( ) : #NEWLINE# #INDENT# return NCElement ( self . _reply , self . _device_handler . transform_reply ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . _reply #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise TimeoutExpiredError ( 'ncclient timed out while waiting for an rpc reply.' )