def truncate(st, size=80):
    """
    Truncate string to the maximum given size.
    """
    if size is None:
        return st
    if len(st) > size:
        return st[:size - 3] + '...'
    return st
