def synchronized(lock):
    def wrapper(func):
        @functools.wraps(func)
        def inner(*args, **kwds):
            lock.acquire()
            try:
                return func(*args, **kwds)
            finally:
                lock.release()
        return inner
    return wrapper
Synchronization decorator.
dataset/ETHPy150Open blampe/IbPy/ib/lib/__init__.py/synchronized