def saber_generate_packet(addr, cmd, data) -> bytes:
    """
    Generate a 4-byte packet conforming to the packetized serial protocol.
    Generates the checksum for you.

    Parameters:
    addr -- address byte, > 128
    cmd -- command byte, < 128
    data -- data byte, < 128

    Returns:
    A 4-byte bytes object suitable for sending to a sabertooth
    """
    checksum = ((addr + cmd + data) % 256) & 0b01111111
    return bytes((addr, cmd, data, checksum))