Update couchdb.py

Modifying locking as suggested.