def ellipsis(text, length, cutoff='[...]'):
    """ shortens text with a [...] at the end """
    return text if len(text) <= length else \
            text[:length - len(text) - len(cutoff)] + cutoff