#NEWLINE# def unquote( s ) : #NEWLINE# #INDENT# '\n    Undo the effects of quote(). Based heavily on urllib.unquote().\n    ' #NEWLINE# mychr = chr #NEWLINE# myatoi = int #NEWLINE# list = s . split ( '_' ) #NEWLINE# res = [ list [ 0 ] ] #NEWLINE# myappend = item . append #NEWLINE# del list [ 0 ] #NEWLINE# for item in list : #NEWLINE# #INDENT# if item [ 1 : 2 ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# myappend ( ( mychr ( myatoi ( item [ : 2 ] , 16 ) ) + item [ 2 : ] ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# myappend ( ( '_' + item ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# myappend ( ( '_' + item ) ) #NEWLINE# #UNINDENT# #UNINDENT# return '' . join ( res )