import textwrap


def shortentext(text, minlength, placeholder='...'):
    """

    Shorten some text by replacing the last part with a placeholder (such as '...')

    text:
    The text to shorten

    minlength:
    The minimum length before a shortening will occur

    placeholder:
    The text to append after removing protruding text. Default is '...'.

    """

    return textwrap.shorten(text, minlength, placeholder=str(placeholder))