code: def lock(func):
          
          @functools.wraps(func)
          def _func(*args, **kwargs):
              mutex.acquire()
              try:
                  return func(*args, **kwargs)
              finally:
                  mutex.release()
          return _func
docs: 互斥锁