#NEWLINE# def _urlencode( items ) : #NEWLINE# #INDENT# 'A Unicode-safe URLencoder.' #NEWLINE# try : #NEWLINE# #INDENT# return urllib . urlencode ( items ) #NEWLINE# #UNINDENT# except UnicodeEncodeError : #NEWLINE# #INDENT# return urllib . urlencode ( [ ( k , smart_str ( v ) ) for ( k , v ) in items ] )