code: def acquire_lock(self):
  		
  		# first ensure that a record exists for this session id
  		try:
  			self.collection.insert_one(dict(_id=self.id))
  		except pymongo.errors.DuplicateKeyError:
  			pass
  		unlocked_spec = dict(_id=self.id, locked=None)
  		lock_timer = (
  			timers.Timer.after(self.lock_timeout)
  			if self.lock_timeout
  			else timers.NeverExpires()
  		)
  		while not lock_timer.expired():
  			locked_spec = {'$set': dict(locked=datetime.datetime.utcnow())}
  			res = self.collection.update_one(unlocked_spec, locked_spec)
  			if res.raw_result['updatedExisting']:
  				# we have the lock
  				break
  			time.sleep(0.1)
  		else:
  			raise LockTimeout(f"Timeout acquiring lock for {self.id}")
  		self.locked = True
docs: Acquire the lock. Blocks indefinitely until lock is available
  		unless `lock_timeout` was supplied. If the lock_timeout elapses,
  		raises LockTimeout.