def create_url(urlbase, urlargd, escape_urlargd=True, urlhash=None):
separator = '<STR_LIT>'<EOL>output = urlbase<EOL>if urlargd:<EOL><INDENT>output += '<STR_LIT:?>'<EOL>if escape_urlargd:<EOL><INDENT>arguments = [escape(quote(str(key)), quote=True) + '<STR_LIT:=>' +<EOL>escape(quote(str(urlargd[key])), quote=True)<EOL>for key in urlargd.keys()]<EOL><DEDENT>else:<EOL><INDENT>arguments = [str(key) + '<STR_LIT:=>' + str(urlargd[key])<EOL>for key in urlargd.keys()]<EOL><DEDENT>output += separator.join(arguments)<EOL><DEDENT>if urlhash:<EOL><INDENT>output += "<STR_LIT:#>" + escape(quote(str(urlhash)))<EOL><DEDENT>return output<EOL>
Creates a W3C compliant URL. Output will look like this:
    'urlbase?param1=value1&amp;param2=value2'
    @param urlbase: base url (e.g. config.CFG_SITE_URL/search)
    @param urlargd: dictionary of parameters. (e.g. p={'recid':3, 'of'='hb'}
    @param escape_urlargd: boolean indicating if the function should escape
                           arguments (e.g. < becomes &lt; or " becomes &quot;)
    @param urlhash: hash string to add at the end of the link