def truncate(data: str, length: int, append: str = "") -> str:
    """
    Truncates a string to the given length\n
    `data` The string to truncate\n
    `length` The length to truncate to\n
    `append` Text to append to the end of truncated string. Default: ''
    """
    return (data[:length] + append) if len(data) + len(append) > length else data