code: def _host_device_to_id(device_str):
      assert isinstance(device_str, str)
      id_string = (
          device_str.lower().split("/task:")[1].split("/device:")[0]
      )
      id_int = int(id_string)
      assert str(id_int) == id_string
      return id_int
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import threading
  import time
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow.compat.v1
  from tensorflow.python.framework import ops
  from tensorflow.python.tpu import tpu_feed
label_desc: Use image node_id 1 for calling a global function with example usage: _host_device_to_id(device_str) and returns: id_int