code: def _get_scaffold(captured_scaffold_fn):
      """Retrieves the Scaffold from `captured_scaffold_fn`."""
      scaffold_fn = captured_scaffold_fn.get()
  
      if not scaffold_fn:
          return None
  
      scaffold = scaffold_fn()
      if scaffold is None:
          raise ValueError(
              "TPUEstimatorSpec.scaffold_fn returns None, which is not allowed"
          )
  
      return scaffold
  
imports: import contextlib
  from tensorflow.compiler.jit.ops import xla_ops
  from tensorflow.compiler.jit.ops import xla_ops_grad
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.python.distribute import summary_op_util
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import compat
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.compat import collections_abc
  from tensorflow.python.util.deprecation import deprecated
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling a global function with example usage: _get_scaffold(captured_scaffold_fn) and returns: scaffold, None