code: def reverse_byte_order(self, data):
          
          # Courtesy Vishal Sapre
          byte_count = len(hex(data)[2:].replace('L', '')[::2])
          val = 0
          for i in range(byte_count):
              val = (val << 8) | (data & 0xff)
              data >>= 8
          return val
docs: Reverses the byte order of an int (16-bit) or long (32-bit) value.