code: def _create_estimator_spec(
      head, features, labels, mode, logits, use_tpu
  ):
      """Creates the head's EstimatorSpec or TPUEstimatorSpec on TPU."""
  
      if use_tpu:
          create_spec_fn = (
              head._create_tpu_estimator_spec
          )  # pylint: disable=protected-access
      else:
          create_spec_fn = head.create_estimator_spec
      return create_spec_fn(
          features=features,
          labels=labels,
          mode=mode,
          logits=logits,
          train_op_fn=lambda _: tf.no_op(),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import contextlib
  import copy
  import functools
  import inspect
  import os
  from absl import logging
  from adanet import ensemble
  from adanet import subnetwork
  from adanet import tf_compat
  from adanet.core.architecture import _Architecture
  from adanet.core.eval_metrics import _EnsembleMetrics
  from adanet.core.eval_metrics import _SubnetworkMetrics
  from adanet.core.summary import monkey_patched_summaries
  import tensorflow.compat.v1
  import tensorflow.compat.v2
label_desc: Use image node_id 8 for calling a global function with example usage: _create_estimator_spec(head, features, labels, mode, logits, use_tpu) and returns: create_spec_fn