Port of binascii library from Python