#NEWLINE# def did_you_mean( message , user_input , choices ) : #NEWLINE# #INDENT# if ( not choices ) : #NEWLINE# #INDENT# return message #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = { difflib . SequenceMatcher ( a = user_input , b = choice ) . ratio ( ) : choice for choice in choices } #NEWLINE# message += ( '\nDid you mean: %s?' % result [ max ( result ) ] ) #NEWLINE# return message