code: def synchronized(func):
      
      @wraps(func)
      def wrapped(self, *args, **kwargs):
          try:
              rlock = self._sync_lock
          except AttributeError:
              from multiprocessing import RLock
              rlock = self.__dict__.setdefault('_sync_lock', RLock())
          with rlock:
              return func(self, *args, **kwargs)
      return wrapped
docs: Decorator for synchronizing method access.