def truncate(string, width):
if len(string) > width:<EOL><INDENT>return string[:width-<NUM_LIT:3>] + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>return string.ljust(width)<EOL><DEDENT>
Truncates/pads the string to be the the specified length,
including ellipsis dots if truncation occurs.