import textwrap


def shorten(text, width=70, placeholder='...'):
    """Shortens text to a max length.

    Shortens text to a max length using some optional placeholder
    with textwrap (if Python > 3.3) or a custom method.
    :param text: The text to shorten
    :type text: str
    :param width: The max width, defaults to 70
    :type width: number, optional
    :param placeholder: The placeholder to truncate with, defaults to '...'
    :type placeholder: str, optional
    :returns: The shortened text with placeholder
    :rtype: {str}
    """
    try:
        textwrap.indent
    except AttributeError:  # function wasn't added until Python 3.3
        return (text
                if len(text) <= width
                else text[:width - len(placeholder)] + placeholder)
    else:
        return textwrap.shorten(text, width=width, placeholder=placeholder)