Work around the 'trailing L' issue when calling hex() in 32-bit machines,
present in Python 2.7. It was later fixed in Python 3.0.

From http://docs.python.org/3/whatsnew/3.0.html:
  "The repr() of a long integer doesn’t include the trailing L anymore, so
   code that unconditionally strips that character will chop off the last digit
   instead. (Use str() instead.)"