def do_truncate(s, length=255, killwords=False, end='...'):
    if len(s) <= length:
        return s
    elif killwords:
        return s[:length - len(end)] + end

    result = s[:length - len(end)].rsplit(' ', 1)[0]
    if len(result) < length:
        result += ' '
    return result + end
Return a truncated copy of the string. The length is specified
dataset/ETHPy150Open GoogleCloudPlatform/appengine-flask-skeleton/lib/jinja2/filters.py/do_truncate