code: def get_host_for_device(device):
      """Returns the corresponding host device for the given device."""
      spec = tf_device.DeviceSpec.from_string(device)
      return tf_device.DeviceSpec(
          job=spec.job,
          replica=spec.replica,
          task=spec.task,
          device_type="CPU",
          device_index=0,
      ).to_string()
  
file_path: tensorflow-upstream/tensorflow/python/distribute/device_util.py
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import device
  from tensorflow.python.framework import ops
label_desc: Use image node_id 5 for calling a global function with example usage: get_host_for_device(device) and returns: tf_device