code: def test_mode_is_kept(remove_asserts):
      mode = (
          Mode().including("local_remove_all_assert")
          if remove_asserts
          else None
      )
      x, _ = pytensor.scan(
          fn=lambda x: pt.random.normal(assert_op(x, x > 0)),
          outputs_info=[pt.ones(())],
          n_steps=10,
          mode=mode,
      )
      x.name = "x"
      x_vv = x.clone()
      x_logp = pytensor.function([x_vv], pt.sum(logp(x, x_vv)))
  
      x_test_val = np.full((10,), -1)
      if remove_asserts:
          assert x_logp(x=x_test_val)
      else:
          with pytest.raises(AssertionError):
              x_logp(x=x_test_val)
  
imports: import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  from pytensor import Mode
  from pytensor.raise_op import assert_op
  from pytensor.scan.utils import ScanArgs
  from scipy import stats
  from pymc.logprob.abstract import _logprob_helper
  from pymc.logprob.basic import conditional_logp, logp
  from pymc.logprob.scan import construct_scan, convert_outer_out_to_in, get_random_outer_outputs
  from pymc.testing import assert_no_rvs
label_desc: Use image node_id 6 for calling a global function with example usage: test_mode_is_kept(remove_asserts) without return types