def endianSwapU16(bytes):
    """Swaps pairs of bytes (16-bit words) in the given bytearray."""
    for b in range(0, len(bytes), 2):
        bytes[b], bytes[b + 1] = bytes[b + 1], bytes[b]
    return bytes
def endianSwapU16 ( bytes ) : for b in range ( 0 , len ( bytes ) , 2 ) : bytes [ b ] , bytes [ b + 1 ] = bytes [ b + 1 ] , bytes [ b ] return bytes
Swaps pairs of bytes (16-bit words) in the given bytearray.