code: def _get_initial_and_final_steps_with_action_mask(
      observations: types.NestedTensorOrArray, objectives: np.ndarray
  ):
      batch_size = tf.nest.flatten(observations)[0].shape[0]
      assert len(objectives.shape) == 2
      assert objectives.shape[0] == batch_size
      assert objectives.shape[1] > 1
      initial_step = ts.TimeStep(
          tf.constant(
              ts.StepType.FIRST,
              dtype=tf.int32,
              shape=[batch_size],
              name="step_type",
          ),
          tf.constant(
              0.0,
              dtype=tf.float32,
              shape=objectives.shape,
              name="reward",
          ),
          tf.constant(
              1.0, dtype=tf.float32, shape=[batch_size], name="discount"
          ),
          (observations[0], observations[1]),
      )
      final_step = ts.TimeStep(
          tf.constant(
              ts.StepType.LAST,
              dtype=tf.int32,
              shape=[batch_size],
              name="step_type",
          ),
          tf.constant(objectives, dtype=tf.float32, name="reward"),
          tf.constant(
              1.0, dtype=tf.float32, shape=[batch_size], name="discount"
          ),
          (
              tf.nest.map_structure(
                  lambda x: x + 100.0, observations[0]
              ),
              observations[1],
          ),
      )
      return initial_step, final_step
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import List, Tuple
  import numpy
  import tensorflow
  from tf_agents.bandits.agents import greedy_multi_objective_neural_agent
  from tf_agents.bandits.drivers import driver_utils
  from tf_agents.bandits.multi_objective import multi_objective_scalarizer
  from tf_agents.bandits.networks import global_and_arm_feature_network
  from tf_agents.bandits.networks import heteroscedastic_q_network
  from tf_agents.bandits.specs import utils
  from tf_agents.networks import network
  from tf_agents.policies import utils
  from tf_agents.specs import array_spec
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 2 for calling a global function with example usage: _get_initial_and_final_steps_with_action_mask(observations, objectives) and returns: initial_step,  final_step