code: def synchronized(wrapped):
      
      _lock = threading.RLock()
  
      @functools.wraps(wrapped)
      def _wrapper(*args, **kwargs):
          with _lock:
              return wrapped(*args, **kwargs)
      return _wrapper
docs: The missing @synchronized decorator
  
      https://git.io/vydTA