def shorten_text(text: str):
    """Return a short repr of text if it is longer than 40"""
    if len(text) <= 40:
        text = text
    else:
        text = text[:17] + ' ... ' + text[-17:]
    return repr(text)