code: def _quote_query(query):
      
      return "&".join("%s=%s" % (
          k, urllib_quote(
              unicode(query[k]).encode('utf-8'), safe='~'))
              for k in sorted(query))
docs: Turn a dictionary into a query string in a URL, with keys
      in alphabetical order.