#NEWLINE# def find_device( self , name ) : #NEWLINE# #INDENT# devices = self . device . list ( ) #NEWLINE# if ( not name ) : #NEWLINE# #INDENT# msg = 'Here are all the devices that I found' #NEWLINE# device_list = '\n' . join ( [ device [ 'name' ] for device in devices ] ) #NEWLINE# result = ( ( ( msg + '\n```' ) + device_list ) + '```' ) #NEWLINE# return result #NEWLINE# #UNINDENT# devices = [ device for device in devices if re . search ( name , device [ 'name' ] ) ] #NEWLINE# formatted_devices = self . _format_devices ( devices ) #NEWLINE# if ( len ( formatted_devices ) == 0 ) : #NEWLINE# #INDENT# formatted_devices = [ { #NEWLINE# #INDENT# 'text' : "Sorry, I couldn't find a device with that name :(" , #NEWLINE# 'color' : COLOR , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# return formatted_devices