code: def _synchronized(func):
      """A decorator for geocoder methods which makes the method always run
      under a lock. The lock is reentrant.
  
      This decorator transparently handles sync and async working modes.
      """
  
      sync_lock = threading.RLock()
  
      def locked_sync(self, *args, **kwargs):
          with sync_lock:
              return func(self, *args, **kwargs)
  
      # At the moment this decorator is evaluated we don't know if we
      # will work in sync or async mode.
      # But we shouldn't create the asyncio Lock in sync mode to avoid
      # unwanted implicit loop initialization.
      async_lock = None  # asyncio.Lock()
      async_lock_task = None  # support reentrance
  
      async def locked_async(self, *args, **kwargs):
          nonlocal async_lock
          nonlocal async_lock_task
  
          if async_lock is None:
              async_lock = asyncio.Lock()
  
          if async_lock.locked():
              assert async_lock_task is not None
              if compat.current_task() is async_lock_task:
                  res = func(self, *args, **kwargs)
                  if inspect.isawaitable(res):
                      res = await res
                  return res
  
          async with async_lock:
              async_lock_task = compat.current_task()
              try:
                  res = func(self, *args, **kwargs)
                  if inspect.isawaitable(res):
                      res = await res
                  return res
              finally:
                  async_lock_task = None
  
      @functools.wraps(func)
      def f(self, *args, **kwargs):
          run_async = isinstance(self.adapter, BaseAsyncAdapter)
          if run_async:
              return locked_async(self, *args, **kwargs)
          else:
              return locked_sync(self, *args, **kwargs)
  
      return f
  
imports: import asyncio
  import functools
  import inspect
  import threading
  from geopy import compat
  from geopy.adapters import AdapterHTTPError, BaseAsyncAdapter, BaseSyncAdapter, RequestsAdapter, URLLibAdapter, get_retry_after
  from geopy.exc import ConfigurationError, GeocoderAuthenticationFailure, GeocoderInsufficientPrivileges, GeocoderQueryError, GeocoderQuotaExceeded, GeocoderRateLimited, GeocoderServiceError, GeocoderTimedOut
  from geopy.point import Point
  from geopy.util import __version__, logger
label_desc: Use image node_id 2 for calling a global function with example usage: _synchronized(func) and returns: f, func, locked_async, locked_sync, res, res