If you want to parse a bytes()
into something you can do arithmetics with, you can do
import struct
a=b'\xca\xfe\xba\xbe' # let's say I just received these bytes
struct.unpack(">I", a)
# -> (3405691582,)
struct.unpack(">I", a)[0]
# -> 3405691582
hex(struct.unpack(">I", a)[0])
# -> '0xcafebabe' - exactly what I expected.
To find out the other way and how to apply that on network communication, I'll leave to you as an exercise.