#NEWLINE# def _find_app_protocol( self , function_name , candidates ) : #NEWLINE# #INDENT# '\n        Return the first protocol in candidates whihc\n        is supported by this device. additionally, check\n        that the datatypes which are returned by the give\n        protocol are implented by this python module.\n        If not a warning is logged. (but no excetpion is raised._\n        This allows raw data dump to succeed, but trx generation to fail.\n        ' #NEWLINE# cls = get_proto_cls ( self . protocol_array , candidates ) #NEWLINE# data_types = self . data_types_by_protocol . get ( cls . __name__ , [ ] ) #NEWLINE# data_type_cls = [ globals ( ) . get ( nm , DataType ) for nm in data_types ] #NEWLINE# if ( not cls ) : #NEWLINE# #INDENT# _log . warning ( 'Download may FAIL. Protocol unimplemented. %s:%s' , function_name , candidates ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _log . debug ( 'Using %s%s for: %s' , cls . __name__ , data_types , function_name ) #NEWLINE# if ( DataType in data_type_cls ) : #NEWLINE# #INDENT# _log . warning ( 'Download may FAIL. DataType unimplemented. %s:%s%s' , function_name , cls . __name__ , data_types ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return cls ( self , * data_type_cls ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# _log . warning ( 'Download may Fail. Failed to ceate protocol %s.' , function_name , exc_info = True )