code: def synchronized(lock):
      def decorator(f):
          # See e.g. https://www.python.org/dev/peps/pep-0318/#examples
          def new_fn(*args, **kwargs):
              with lock:
                  return f(*args, **kwargs)
  
          return new_fn
  
      return decorator
  
imports: import importlib
  import sys
  import threading
label_desc: Use image node_id 1 for calling a global function with example usage: synchronized(lock) and returns: decorator, new_fn, f