A simple trick to save the script form loading "struct" module and converting string or binary data to number is as :

num = int(data[:4][::-1].encode("hex"),16)

and vice-versa would be :
...