def _did_you_mean(name, choices):
 if (not choices):
  return None
 name = name.lower()
 candidates = [(_levenshtein(name, c), c) for c in choices]
 candidates.sort()
 if (candidates[0][0] <= 3):
  return candidates[0][1]
 return None

def _did_you_mean ( name , choices ) : if ( not choices ) : return None name = name . lower ( ) candidates = [ ( _levenshtein ( name , c ) , c ) for c in choices ] candidates . sort ( ) if ( candidates [ 0 ] [ 0 ] <= 3 ) : return candidates [ 0 ] [ 1 ] return None
suggest most likely setting based on levenshtein .