code: def test_nesting_error():
      @pipeline_def(
          enable_conditionals=True,
          num_threads=4,
          batch_size=8,
          device_id=0,
      )
      def pipeline():
          pred = fn.external_source(
              source=lambda x: np.array(x.idx_in_batch % 2), batch=False
          )
          if pred:
              out = {"out": np.array(2), "mismatched": np.array(9999)}
          else:
              out = {"out": np.array(1)}
          return out
  
      with assert_raises(
          ValueError,
          glob=(
              "*Divergent data found in different branches of `if/else` control"
              " flow statement. Variables in all code paths are merged into common"
              " output batches. The values assigned to a given variable need to"
              " have the same nesting structure in every code path"
              " (both `if` branches).*"
              "*The two structures don't have the same nested structure*"
              "*The two dictionaries don't have the same set of keys."
              " First structure has keys type=list str=*'out', 'mismatched'*,"
              " while second structure has keys type=list str=*'out'*"
          ),
      ):
          _ = pipeline()
  
imports: from nvidia.dali import fn, pipeline_def, types
  import numpy
  from test_utils import check_batch
  from nose_utils import assert_raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_nesting_error() and returns: out