class_docstr: Cluster Resolver for Google Cloud TPUs.
  
  This is an implementation of cluster resolvers for the Google Cloud TPU
  service.
  
  TPUClusterResolver supports the following distinct environments:
  Google Compute Engine
  Google Kubernetes Engine
  Google internal
  
  It can be passed into `tf.distribute.TPUStrategy` to support TF2 training on
  Cloud TPUs.
docstr: Verifies that every device in device_dict has the same # of cores.
docstr_tok: ["Verifies","that","every","device","in","device_dict","has","the","same","#","of","cores","."]
code: def _verify_and_return_same_core_count(device_dict):
      """Verifies that every device in device_dict has the same # of cores."""
      num_cores_per_host_set = {
          len(core_ids) for core_ids in device_dict.values()
      }
      if len(num_cores_per_host_set) != 1:
          raise RuntimeError(
              "TPU cores on each device is not the same. This "
              "should never happen. Devices: {}".format(device_dict)
          )
      return num_cores_per_host_set.pop()
  
imports: import collections
  import re
  from tensorflow.core.protobuf.tpu import topology_pb2
  from tensorflow.python.distribute.cluster_resolver import cluster_resolver
  from tensorflow.python.eager import remote
  from tensorflow.python.framework import config
  from tensorflow.python.framework import errors
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.tpu import tpu_strategy_util
  from tensorflow.python.tpu import tpu_system_metadata
  from tensorflow.python.training import server_lib
  from tensorflow.python.util import compat
label_desc: Use image node_id 3 for calling the TPUClusterResolver obj's underlying member method code with example usage: obj._verify_and_return_same_core_count(device_dict) and returns: num_cores_per_host_set