code: def _build_step(
      prev_step: Any,
      step: Any,
      step_fn: Callable[[Dict[str, Any]], Dict[str, Any]],
  ) -> Dict[str, Any]:
      """Builds an RLDS step from two envlogger steps."""
      rlds_step = _get_step_metadata(prev_step)
      rlds_step["observation"] = prev_step.timestep.observation
      rlds_step["action"] = step.action
      rlds_step["reward"] = step.timestep.reward
      rlds_step["discount"] = step.timestep.discount
      rlds_step["is_terminal"] = False
      rlds_step["is_first"] = prev_step.timestep.first()
      rlds_step["is_last"] = prev_step.timestep.last()
  
      return step_fn(rlds_step)
  
file_path: datasets/tensorflow_datasets/rlds/envlogger_reader.py
imports: from typing import Any, Callable, Dict, Generator, List, Optional, Sequence, Tuple, Union
  import numpy
  from tensorflow_datasets.core.utils import tree_utils
label_desc: Use image node_id 6 for calling a global function with example usage: _build_step(prev_step, step, step_fn) and returns: step_fn