#NEWLINE# def _get( self , message ) : #NEWLINE# #INDENT# self . _txid = txid = ( self . _txid + 1 ) #NEWLINE# queue = self . _pebble . get_endpoint_queue ( GetBytes ) #NEWLINE# try : #NEWLINE# #INDENT# self . _pebble . send_packet ( GetBytes ( transaction_id = txid , message = message ) ) #NEWLINE# info = queue . get ( ) . message #NEWLINE# assert isinstance ( info , GetBytesInfoResponse ) #NEWLINE# if ( info . error_code != GetBytesInfoResponse . ErrorCode . Success ) : #NEWLINE# #INDENT# raise GetBytesError ( info . error_code ) #NEWLINE# #UNINDENT# data = array ( 'B' , ( 0 for _ in range ( info . num_bytes ) ) ) #NEWLINE# bytes_received = 0 #NEWLINE# while ( bytes_received < info . num_bytes ) : #NEWLINE# #INDENT# part = queue . get ( ) . message #NEWLINE# assert isinstance ( part , GetBytesDataResponse ) #NEWLINE# bytes_received += len ( part . data ) #NEWLINE# data [ part . offset : ( part . offset + len ( part . data ) ) ] = array ( 'B' , part . data ) #NEWLINE# #UNINDENT# return data . tostring ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# queue . close ( )