code: def check_number_of_ops(loops, memories, variables, lookup, mutate):
      def wrapper(test_method):
          def new_impl(self, *args, **kwargs):
              target = "cupy._core._fusion_trace.TraceImpl"
              with mock.patch(target, CreateMock(target)) as m:
                  result = test_method(self, *args, **kwargs)
                  m.check_number_of_ops(
                      loops, memories, variables, lookup, mutate
                  )
              return result
  
          return new_impl
  
      return wrapper
  
imports: import unittest
  from unittest import mock
  import cupy
  from cupy import testing
  from cupy_tests.core_tests.fusion_tests import fusion_utils
label_desc: Use image node_id 1 for calling a global function with example usage: check_number_of_ops(loops, memories, variables, lookup, mutate) and returns: wrapper, new_impl, result