Well, after a little more digging I found cgi.parse_qsl() which does what I wanted to do and more, and the resulting list is can be passed into urlencode. Thanks for the help Oleg.