title: Using a Lock with redis-py
body: <p>I'm trying to create a lock on a redis value in a django project, but am having trouble. Non blocking code works just fine, ie:</p>
  
  <pre><code>r = redis.StrictRedis(host='localhost', port=6379)
  data_dict = {'key': 'value'}
  r.hmset('hash', data_dict)
  </code></pre>
  
  <p>However when trying to use a lock to prevent other threads from writing to this, with code:</p>
  
  <pre><code>r = redis.StrictRedis(host='localhost', port=6379)
  data_dict = {'key': 'value'}
  lock = r.lock('hash')
  with lock.acquire() as l:
      r.hmset('hash', data_dict)
  </code></pre>
  
  <p>throws:<code>redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value</code></p>
  
  <p>I apologize if this is a very stupid question but I don't understand how I'm getting that error, the data being set is literally the same</p>