code: def relock_repo(f):
      @wraps(f)
      def wrapper(stage, *args, **kwargs):
          stage.repo.lock.lock()
          try:
              ret = f(stage, *args, **kwargs)
          finally:
              stage.repo.lock.unlock()
              stage.repo._reset()
          return ret
  
      return wrapper
  
imports: from functools import wraps
  from funcy import decorator
label_desc: Use image node_id 3 for calling a global function with example usage: relock_repo(f) and returns: wrapper, ret