code: def synchronized(func):
      """Decorator for storage-access methods, which synchronizes on a threading
      lock. The parent object must have 'is_closed' and '_sync_lock' attributes.
      """
  
      @wraps(func)
      def synchronized_wrapper(self, *args, **kwargs):
          with self._sync_lock:
              return func(self, *args, **kwargs)
  
      return synchronized_wrapper
  
file_path: whoosh/src/whoosh/util/__init__.py
imports: from __future__ import with_statement
  import random, sys, time
  from bisect import insort
  from functools import wraps
  from whoosh.compat import xrange
label_desc: Use image node_id 6 for calling a global function with example usage: synchronized(func) and returns: synchronized_wrapper, func