def trunc_bytes_at(
    msg: bytes, delim: bytes = b"{", start: int = 1, occurrence: int = 1
):
    """Truncates bytes starting from a given point at nth occurrence of a
    delimiter."""
    return delim.join(msg[start:].split(delim, occurrence)[:occurrence])