#!/usr/bin/env python

import sys

orig_str = str

def str(s, enc="ascii"):
    if sys.version_info[0] == 3:
        return orig_str(s, enc)
    else:
        return orig_str(s)


orig_bytes = bytes

def bytes(s, enc="ascii"):
    if sys.version_info[0] == 3:
        return orig_bytes(s, enc)
    else:
        return orig_bytes(s)

try:
    import urllib.request as urllib
except ImportError:
    import urllib2 as urllib

try:
    from urllib.parse import urlparse
except ImportError:
    from urlparse import urlparse

@@ -32,173 +32,115 @@
 ys%0A%0A
-orig_str = str%0A%0Adef str(s, enc=%22ascii%22):%0A    if sys.version_info%5B0%5D == 3:%0A        return orig_str(s, enc)%0A    else
+is_py2 = (sys.version_info%5B0%5D == 2)%0Ais_py3 = (sys.version_info%5B0%5D == 3)%0A%0Aif is_py2
 :%0A    
- 
-   return orig_str(s)%0A%0A%0Aorig_bytes = bytes%0A%0A
+str = unicode%0A%0A    
 def 
@@ -141,25 +141,25 @@
   def bytes(
-s
+b
 , enc=%22ascii
@@ -170,109 +170,71 @@
     
-if sys.version_info%5B0%5D == 3:%0A        return orig_bytes(s, enc)%0A    else:%0A        return orig_bytes(s)
+    return str(b)%0A%0Aelif is_py3:%0A    str = str%0A    bytes = bytes
 %0A%0Atr
@@ -364,16 +364,26 @@
 urlparse
+, parse_qs
 %0Aexcept 
@@ -428,9 +428,19 @@
 urlparse
+, parse_qs
 %0A

Simplify Python compat.