code: def _valid_range_ids(last_id, capacity):
      """Returns the [min_val, max_val) range of ids.
  
      Args:
        last_id: A tensor that indicates the last id stored in the replay buffer.
        capacity: The maximum number of elements that the replay buffer can hold.
  
      Returns:
        A tuple (min_id, max_id) for the range [min_id, max_id) of valid ids.
      """
      min_id_non_full = tf.constant(0, dtype=tf.int64)
      max_id_non_full = tf.maximum(last_id + 1, 0)
  
      min_id_full = tf.cast(last_id + 1 - capacity, dtype=tf.int64)
      max_id_full = tf.cast(last_id + 1, dtype=tf.int64)
  
      return (
          tf.where(last_id < capacity, min_id_non_full, min_id_full),
          tf.where(last_id < capacity, max_id_non_full, max_id_full),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import gin
  import tensorflow
  from tf_agents import specs
  from tf_agents.replay_buffers import episodic_table
  from tf_agents.replay_buffers import replay_buffer
  from tf_agents.replay_buffers import table
  from tf_agents.utils import common
  from tensorflow.python.data.util import nest
  from tensorflow.python.layers import utils
  from tensorflow.python.ops import list_ops
  from tensorflow.python.ops.distributions import util
label_desc: Use image node_id 1 for calling a global function with example usage: _valid_range_ids(last_id, capacity) and returns: tf,  tf