code: def setup_teardown_executor(setup, teardown):
      setup = setup or (lambda: None)
      teardown = teardown or (lambda ex: None)
  
      def execute(function):
          token = None
          try:
              token = setup()
              return function()
          finally:
              teardown(token)
  
      return execute
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/executors.py
imports: from __future__ import absolute_import, division, print_function
label_desc: Use image node_id 2 for calling a global function with example usage: setup_teardown_executor(setup, teardown) and returns: execute, function