def _cut_if_too_long(text: str, max_length: int) -> str:
    """Cut a string down to the maximum length.

    Args:
        text: Text to check.
        max_length: The maximum length of the resulting string.

    Returns:
        Cut string with ... added at the end if it was too long.
    """
    if len(text) <= max_length:
        return text
    return text[: max_length - 3] + "..."