Truncates/pads the string to be the the specified length,
    including ellipsis dots if truncation occurs.

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