code: def unfold_batch(batch, num_expand):
      assert num_expand >= 0
      if num_expand == 0:
          return batch
      if num_expand > 1:
          batch = [
              sample.reshape((-1,) + sample.shape[num_expand:])
              for sample in batch
          ]
      return [frame for sample in batch for frame in sample]
  
imports: import os
  import random
  import numpy
  from typing import List, Union, Callable, Optional
  from dataclasses import dataclass, field
  from nvidia.dali import pipeline_def
  import nvidia.dali.fn
  from nvidia.dali import types
  import nvidia.dali.tensors
  from test_utils import get_dali_extra_path, check_batch
label_desc: Use image node_id 4 for calling a global function with example usage: unfold_batch(batch, num_expand) and returns: unknown, batch