def truncate(string, length, ellipsis="<STR_LIT>"):
if len(string) > length:<EOL><INDENT>return string[: length - len(ellipsis)] + ellipsis<EOL><DEDENT>return string<EOL>
Truncate a string to a length, ending with '...' if it overflows