Use codecs.decode instead of str.decode for Py3k compatibility.