code: def make_decorator(test_case_generator):
      # `test_case_generator` is a callable that receives the source test class
      # (typically a subclass of unittest.TestCase) and returns an iterable of
      # generated test cases.
      # Each element of the iterable is a 3-element tuple:
      # [0] Generated class name
      # [1] Dict of members
      # [2] Method generator
      # The method generator is also a callable that receives an original test
      # method and returns a new test method.
  
      def f(cases):
          if isinstance(cases, _ParameterizedTestCaseBundle):
              # The input is a parameterized test case.
              cases = cases.cases
          else:
              # Input is a bare test case, i.e. not one generated from another
              # parameterize.
              cases = [_TestCaseTuple(cases, None, None)]
  
          generated_cases = []
          for klass, mod_name, cls_name in cases:
              if mod_name is not None:
                  # The input is a parameterized test case.
                  # Remove it from its module.
                  delattr(sys.modules[mod_name], cls_name)
              else:
                  # The input is a bare test case
                  mod_name = klass.__module__
  
              # Generate parameterized test cases out of the input test case.
              l = _generate_test_cases(
                  mod_name, klass, test_case_generator
              )
              generated_cases += l
  
          # Return the bundle of generated cases to allow repeated application of
          # parameterize decorators.
          return _ParameterizedTestCaseBundle(generated_cases)
  
      return f
  
file_path: chainer/chainer/testing/_bundle.py
imports: import collections
  import inspect
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: make_decorator(test_case_generator) and returns: f, _ParameterizedTestCaseBundle