make python3 port consistent in return type

get bytes from encode and unicode from decode