Fix Py3 compat bug

Also don't use unicode string here because the assertions below are
written for native strings.