code: def num2bytes(x, bytes):
      
      if not isinstance(x, int):  # If it is another "thing", just return ZEROs
          return tuple([0] * bytes)
  
      x = x & ((2 << (bytes * 8)) - 1)  # mask the initial value
      result = ()
  
      for i in range(bytes):
          result += (x & 0xFF,)
          x >>= 8
  
      return result
docs: Returns x converted to a little-endian t-uple of bytes.
      E.g. num2bytes(255, 4) = (255, 0, 0, 0)