add thread lock python example