def letter_scales(counts):
try:<EOL><INDENT>scale = <NUM_LIT:1.0> / sum(counts.values())<EOL><DEDENT>except ZeroDivisionError:<EOL><INDENT>return []<EOL><DEDENT>freqs = [(aa, cnt*scale) for aa, cnt in counts.iteritems() if cnt]<EOL>freqs.sort(key=lambda pair: pair[<NUM_LIT:1>])<EOL>return freqs<EOL>
Convert letter counts to frequencies, sorted increasing.