code: def _make_canonical_query_string(parsed):
      
      query_params = urlparse.parse_qs(parsed.query, keep_blank_values=True)
      sorted_query_params = sorted((k, v)
                                   for k, vs in query_params.items()
                                   for v in vs)
      return urllib.urlencode(sorted_query_params)
docs: Return the canonical query string for a parsed URL.
  
      @param parsed: The parsed URL from which to extract the canonical
          query string.
      @type parsed: L{urlparse.ParseResult}
  
      @return: The canonical query string.
      @rtype: L{str}