title: PYTHON3 (and not is PYTHON2 ) TypeError: Won't implicitly convert Unicode to bytes; use .encode()
body: <p>l have this function that works perfectly with python2 </p>
  
  <pre><code> def writeCache(env, cache):
          with env.begin(write=True) as txn:
              for k, v in cache.items():
                  txn.put(k, v)
  </code></pre>
  
  <p>However when l execute it with <code>python3.5.2</code> it returns the following error :</p>
  
  <pre><code>txn.put(k, v)
  TypeError: Won't implicitly convert Unicode to bytes; use .encode()
  </code></pre>
  
  <p>First try to resolve that :</p>
  
  <pre><code>def writeCache(env, cache):
              with env.begin(write=True) as txn:
                  for k, v in cache.items():
                      k.encode()
  </code></pre>
  
  <p>works but variable  v is not included. </p>
  
  <pre><code>def writeCache(env, cache):
                  with env.begin(write=True) as txn:
                      for k, v in cache.items():
                          k.encode()
                          v.encode()
  </code></pre>
  
  <p>l get the following :</p>
  
  <pre><code>AttributeError: 'bytes' object has no attribute 'encode'
  </code></pre>
  
  <p>which is related to  <code>v.encode()</code></p>