code: def _default_logits(estimator_spec):
      from tensorflow.python.estimator.canned import (
          prediction_keys,
      )  # pylint: disable=g-direct-tensorflow-import,g-import-not-at-top
  
      if isinstance(estimator_spec.predictions, dict):
          pred_keys = prediction_keys.PredictionKeys
          if pred_keys.LOGITS in estimator_spec.predictions:
              return estimator_spec.predictions[pred_keys.LOGITS]
          if pred_keys.PREDICTIONS in estimator_spec.predictions:
              return estimator_spec.predictions[pred_keys.PREDICTIONS]
      return estimator_spec.predictions
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import inspect
  from adanet import subnetwork
  from adanet import tf_compat
  import tensorflow.compat.v2
label_desc: Use image node_id 1 for calling a global function with example usage: _default_logits(estimator_spec) and returns: estimator_spec, estimator_spec, estimator_spec