According to python documentation on "Using locks, conditions, and semaphores in the with statement" in the threading module:
with some_lock: # do s