from typing import Any


def str_capped(object: Any, max_len: int) -> str:
    """Return the string representation of `object` trimmed to `max_len`.

    Trailing ellipsis is added to the returned string if the original had to be trimmed.
    """
    s = str(object)
    if len(s) <= max_len:
        return s
    return s[: max_len - 3] + "..." if max_len >= 3 else "..."