def smart_truncate(text, max_length=100, suffix='...'):
    """
    Returns a string of at most `max_length` characters, cutting
    only at word-boundaries. If the string was truncated, `suffix`
    will be appended.
    """
    if text is None:
        return ''
    if len(text) <= max_length:
        return text
    value = text[:max_length]
    words = value.split(' ')[:-1]
    return ' '.join(words) + suffix
