def checksum(data):
    """
    Compute a checksum for DATA.
    """
    # Remove this later after development
    assert isinstance(data, bytearray), "data must be a bytearray"

    chk = data[0]
    for i in range(1, len(data)):
        chk ^= data[i]
    return chk