query str encode for python3