def truncate_str(s: str, max_len: int, *, suffix: str = "[...]") -> str:
    """Truncate a string so it's no longer than max_len.

    Args:
        s: String to truncate.
        max_len: Max length which will not be exceeded by the returned string.
        suffix: Suffix to append to the end of the string if it's too long.

    Returns:
        New string which is guaranteed to have a length smaller or equal to
        max_len.
    """
    if len(s) <= max_len:
        return s
    else:
        adj_len = max_len - len(suffix)
        if adj_len > 0:
            return s[:adj_len] + suffix
        else:
            return suffix