title: Translate a python dict into a Solr query string
body: <p>I'm just getting started with Python, and I'm stuck on the syntax that I need to convert a set of request.POST parameters to Solr's query syntax. </p>
  
  <p>The use case is a form defined like this:</p>
  
  <pre><code>class SearchForm(forms.Form):
      text = forms.CharField()
      metadata = forms.CharField()
      figures = forms.CharField()
  </code></pre>
  
  <p>Upon submission, the form needs to generate a url-encoded string to pass to a URL client that looks like this:</p>
  
  <pre><code>text:myKeyword1+AND+metadata:myKeyword2+AND+figures:myKeyword3
  </code></pre>
  
  <p>Seems like there should be a simple way to do this.  The closest I can get is </p>
  
  <pre><code>for f, v in request.POST.iteritems():
     if v:
         qstring += u'%s\u003A%s+and+' % (f,v)
  </code></pre>
  
  <p>However in that case the colon (\u003A) generates a Solr error because it is not getting encoded properly.  </p>
  
  <p>What is the clean way to do this?</p>
  
  <p>Thanks!</p>