Use for loop instead of map when not iterating.

In PY3, map returns an iterator, so the funcion never gets called.
Correctly handle binascii.Error.