code: def assert_or_get_global_step(graph=None, global_step_tensor=None):
      """Verifies that a global step tensor is valid or gets one if None is given.
  
      If `global_step_tensor` is not None, check that it is a valid global step
      tensor (using `assert_global_step`). Otherwise find a global step tensor using
      `get_global_step` and return it.
  
      Args:
        graph: The graph to find the global step tensor for.
        global_step_tensor: The tensor to check for suitability as a global step. If
          None is given (the default), find a global step tensor.
  
      Returns:
        A tensor suitable as a global step, or `None` if none was provided and none
        was found.
      """
      if global_step_tensor is None:
          # Get the global step tensor the same way the supervisor would.
          global_step_tensor = get_global_step(graph)
      else:
          assert_global_step(global_step_tensor)
      return global_step_tensor
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import re
  from .arg_scope import add_arg_scope
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python import pywrap_tensorflow
  from tensorflow.python.framework import device
  from tensorflow.python.framework import dtypes
  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 resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import resource_loader
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import saver
  from tensorflow.python.training import training_util
  from tensorflow.python.util.deprecation import deprecated
label_desc: Use image node_id 2 for calling a global function with example usage: assert_or_get_global_step(graph, global_step_tensor) and returns: global_step_tensor