def METHOD_NAME(text: Union[str, bytes], length: int) -> str:
    if isinstance(text, str):
        return text if len(text) < length else (text[: length - 3] + "...")
    return str(text if len(text) < length else (text[: length - 3] + b"..."))