code: def _validate_state(
      state: types.NestedTensor, spec: types.NestedTensorSpec
  ):
      if not nest_utils.is_batched_nested_tensors(
          state, spec, num_outer_dims=1, allow_extra_fields=False
      ):
          raise ValueError(
              "action_step.state does not match spec. "
              "action_step.state.shape: {state_shape}, "
              "spec.shape: {spec_shape}"
              "action_step.state: {state_value}, spec: "
              "{spec_value}".format(
                  state_shape=state.shape,
                  spec_shape=spec.shape,
                  state_value=state,
                  spec_value=spec,
              )
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import typing
  import tensorflow
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.typing import types
  from tf_agents.utils import composite
  from tf_agents.utils import nest_utils
  import typing_extensions
label_desc: Use image node_id 6 for calling a global function with example usage: _validate_state(state, spec) without return types