code: def measure_cost(repeat, scipy_trans_lhs, scipy_dns_lhs, func_name, *args, **kwargs):
      
      mx.nd.waitall()
      args_list = []
      for arg in args:
          args_list.append(arg)
      start = time.time()
      if scipy_trans_lhs:
          args_list[0] = np.transpose(args_list[0]) if scipy_dns_lhs else sp.spmatrix.transpose(args_list[0])
      for _ in range(repeat):
          func_name(*args_list, **kwargs)
      mx.nd.waitall()
      end = time.time()
      diff = end - start
      return diff / repeat
docs: Measure time cost of running a function