def shorten(text, length, add="..."):
	"""Shortens the provided text if it's longer than the length.
	
	If it's longer, add is appended to the end."""

	if text is None:
		return ""

	shortened = text[:length - len(add)]

	if shortened != text:
		return shortened + add

	return shortened