Замок в питоне

import threading 

lock = threading.Lock()
lock.acquire()
# Your code here
lock.release()
Happy Friend