@classmethod
def _checksum(cls, data):
    """
        Calculates the checksum of some data bytes according to the STM32
        bootloader USART protocol.

        :param data: a `bytes` object
        :return: the XOR of all the bytes, i.e. a number between 0x00 and 0xFF
        """
    checksum = 0
    for byte in data:
        checksum ^= byte
    return checksum
