code: def expand_arg(
      expandable_layout, arg_has_frames, input_batch, arg_batch
  ):
      num_expand = len(expandable_layout)
      assert 1 <= num_expand <= 2
      assert all(c in "FC" for c in expandable_layout)
      assert len(input_batch) == len(arg_batch)
      expanded_batch = []
      for input_sample, arg_sample in zip(input_batch, arg_batch):
          if not arg_has_frames or len(arg_sample) == 1:
              arg_sample = (
                  arg_sample if not arg_has_frames else arg_sample[0]
              )
              num_frames = np.prod(input_sample.shape[:num_expand])
              expanded_batch.extend(
                  arg_sample for _ in range(num_frames)
              )
          else:
              frame_idx = expandable_layout.find("F")
              assert frame_idx >= 0
              assert len(arg_sample) == input_sample.shape[frame_idx]
              if num_expand == 1:
                  expanded_batch.extend(
                      arg_frame for arg_frame in arg_sample
                  )
              else:
                  channel_idx = 1 - frame_idx
                  assert expandable_layout[channel_idx] == "C"
                  if channel_idx > frame_idx:
                      expanded_batch.extend(
                          frame_arg
                          for frame_arg in arg_sample
                          for _ in range(
                              input_sample.shape[channel_idx]
                          )
                      )
                  else:
                      expanded_batch.extend(
                          frame_arg
                          for _ in range(
                              input_sample.shape[channel_idx]
                          )
                          for frame_arg in arg_sample
                      )
      return expanded_batch
  
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 7 for calling a global function with example usage: expand_arg(expandable_layout, arg_has_frames, input_batch, arg_batch) and returns: expanded_batch