code: def _extract_node(run_meta, node_name):
      ret = defaultdict(list)
      for dev_stat in run_meta.step_stats.dev_stats:
          dev = dev_stat.device.lower()
          if dev.find("cpu:") > 0:
              dev = dev[dev.find("cpu:") :]
          elif dev.find("gpu:") > 0:
              dev = dev[dev.find("gpu:") :]
          elif "/host:cpu" not in dev:
              assert False, "Unrecognized device name: %s" % dev
  
          for node_stat in dev_stat.node_stats:
              nname = node_stat.node_name
              if nname.find(":") > 0:
                  nname = nname[: nname.find(":")]
              if nname == node_name:
                  ret[dev].append(node_stat)
      return ret
  
imports: from collections import defaultdict
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.profiler import option_builder
  from tensorflow.python.profiler import model_analyzer
  from tensorflow.python.profiler.internal import model_analyzer_testlib
label_desc: Use image node_id 1 for calling a global function with example usage: _extract_node(run_meta, node_name) and returns: ret