def display(counts):
    """Pretty display for word/char counts"""

    maxlen = max(len(str(token)) for token, _ in counts)
    maxfreq = max(freq for _, freq in counts)
    maxfreq = len(str(maxfreq)) + 2

    shape = ''
    for token, freq in counts:
        shape += "{:<{w1}} {:>{w2}}\n".format(
            token, freq, w1=maxlen, w2=maxfreq)
    return shape