[utils] Fix struct.pack call on very old Python versions (#4181)