python: Encode query string as a utf-8 byte array