Is there a good cross-version (Python 2 and Python 3 compatible) way of converting arbitary sized long integers to arrays of bytes and back (both little and big endian)?
I only found one solution to convert byte array to int:
int(codecs.encode(dat, 'hex'), 16)