code: def global_step(sess, global_step_tensor):
      """Small helper to get the global step.
  
      ```python
      # Create a variable to hold the global_step.
      global_step_tensor = tf.Variable(10, trainable=False, name='global_step')
      # Create a session.
      sess = tf.compat.v1.Session()
      # Initialize the variable
      sess.run(global_step_tensor.initializer)
      # Get the variable value.
      print('global_step: %s' % tf.compat.v1.train.global_step(sess,
      global_step_tensor))
  
      global_step: 10
      ```
  
      Args:
        sess: A TensorFlow `Session` object.
        global_step_tensor:  `Tensor` or the `name` of the operation that contains
          the global step.
  
      Returns:
        The global step value.
      """
      if context.executing_eagerly():
          return int(global_step_tensor.numpy())
      return int(sess.run(global_step_tensor))
  
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import graph_io
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import state_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: global_step(sess, global_step_tensor) and returns: int, int