code: def convert_time_step(time_step):
      """Convert to agents time_step type as the __hash__ method is different."""
      reward = time_step.reward
      if reward is None:
          reward = 0.0
      discount = time_step.discount
      if discount is None:
          discount = 1.0
  
      observation = tf.nest.map_structure(
          _maybe_float32, time_step.observation
      )
      return ts.TimeStep(
          ts.StepType(time_step.step_type),
          _as_float32_array(reward),
          _as_float32_array(discount),
          observation,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import numpy
  import tensorflow
  from tf_agents.environments import wrappers
  from tf_agents.specs import array_spec
  from tf_agents.trajectories import time_step
label_desc: Use image node_id 2 for calling a global function with example usage: convert_time_step(time_step) and returns: ts