Also move precision detection to helper function
Ensure bytearray unpacking works on all supported Python versions