#NEWLINE# @ classmethod #NEWLINE# def wait_for_response( cls , send_packet ) : #NEWLINE# #INDENT# packets = collections . OrderedDict ( ) #NEWLINE# while ( len ( packets ) < 1 ) : #NEWLINE# #INDENT# time . sleep ( 0.5 ) #NEWLINE# for obj in cls . incoming_packets : #NEWLINE# #INDENT# if ( obj . packet_id == send_packet . packet_id ) : #NEWLINE# #INDENT# packets [ obj . packet_id ] = obj #NEWLINE# cls . incoming_packets . remove ( obj ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ( key , packet ) = packets . popitem ( ) #NEWLINE# if len ( packets ) : #NEWLINE# #INDENT# while len ( packets ) : #NEWLINE# #INDENT# ( key , multipacket_response ) = packets . popitem ( ) #NEWLINE# packet . decoded [ 'body' ] = '{}{}' . format ( packet . decoded [ 'body' ] , multipacket_response . decoded [ 'body' ] ) #NEWLINE# #UNINDENT# #UNINDENT# if callable ( send_packet . response_callback ) : #NEWLINE# #INDENT# packet . outgoing_command = key . outgoing_command #NEWLINE# send_packet . response_callback ( packet ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out ( 'Unknown callback for: ' , packet . data ) #NEWLINE# #UNINDENT# return True