code: def python_profile(func):
      """Decorator for profiling MXNet operation.
      Uses Python's time module to collect execution time information
      of the operation.
  
      Parameters
      ----------
      func:
          Operation to be executed and timed.
  
      Returns
      -------
      res, timing output. res being result returned after operator execution.
      profiler output is a dictionary with summary of operation execution.
      Example output : { "add": [{"avg_time_add": 0.4053089120425284,
                                  'p50_time_add': 16.761042876169086,
                                  'p90_time_add': 18.081666342914108,
                                  'p99_time_add': 19.060144051909447,
                                  "inputs": {
                                      "lhs": [1024, 1024],
                                      "rhs": [1024,1024]
                                  }]
                       }
      """
  
      @functools.wraps(func)
      def python_profile_it(*args, **kwargs):
          runs = args[1]
          modified_args = (args[0], 1)
          times = []
  
          for _ in range(runs):
              start_time = time.perf_counter()  # 1
              res = func(*modified_args, **kwargs)
              end_time = time.perf_counter()  # 2
              run_time = (end_time - start_time) * 1000  # 3
              times.append(run_time)
  
          # NOTE : same as cpp_profile_it
          if len(args) > 0:
              operator_name = args[0].__name__
          elif "block" in kwargs:
              operator_name = kwargs["block"]._op_name
          else:
              raise ValueError(
                  "Unable to identify operator name to extract profiler output!"
              )
  
          avg_run_time = np.mean(times)
          p50_run_time = np.percentile(times, 50)
          p90_run_time = np.percentile(times, 90)
          p99_run_time = np.percentile(times, 99)
  
          profiler_output = {
              "avg_time_" + str(operator_name): avg_run_time,
              "p50_time_" + str(operator_name): p50_run_time,
              "p90_time_" + str(operator_name): p90_run_time,
              "p99_time_" + str(operator_name): p99_run_time,
          }
          return res, profiler_output
  
      return python_profile_it
  
file_path: mxnet/benchmark/opperf/utils/profiler_utils.py
imports: import time
  import functools
  import numpy
  from .common_utils import merge_map_list
  from mxnet import profiler
label_desc: Use image node_id 5 for calling a global function with example usage: python_profile(func) and returns: python_profile_it, res,  profiler_output