def truncated(text, max_length=100, msg='...'):
    if len(text) < max_length:
        return text
    else:
        return text[:max_length] + msg
>>> truncated("hello world!", 5)
dataset/ETHPy150Open scrapinghub/splash/splash/utils.py/truncated