def synchronized(sync_lock):
    """A decorator synchronizing multi-process access to a resource."""

    def wrapper(f):
        """The decorator's core function.

        :param f:
        :return:
        """

        @functools.wraps(f)
        def inner_wrapper(*args, **kw):
            """

            :param args:
            :param kw:
            :return:
            """
            with sync_lock:
                return f(*args, **kw)

        return inner_wrapper

    return wrapper
def synchronized ( sync_lock ) : def wrapper ( f ) : @ functools . wraps ( f ) def inner_wrapper ( * args , ** kw ) : with sync_lock : return f ( * args , ** kw ) return inner_wrapper return wrapper
A decorator synchronizing multi-process access to a resource.