def truncate_string(string, truncation, message = ''):
    """
    Truncate a string to a given length.  Optionally add a message at the end
    explaining the truncation
    :param string: A string
    :param truncation: An int
    :param message: A message, e.g. '...<truncated>'
    :return: A new string no longer than truncation
    """
    if truncation is None:
        return string
    assert isinstance(truncation, int)
    if len(string)>truncation:
        return string[:truncation-len(message)]+message
    else:
        return string