implemented PY3 check through introducing `compat_str`