tobytes python
# for decimal to bytes
one_byte_little_endian = (10).to_bytes(1,"little")
two_byte_big_endian = (512).to_bytes(2,"big")
# for hexadecimal to bytes
one_byte_little_endian = (0x0a).to_bytes(1,"little")
two_byte_big_endian = (0x0102).to_bytes(2,"big")
CW