code: def _choose_batch_size(inputs, batch_size=-1):
      """Returns batch size based on inputs and batch_size parameter."""
  
      if len(inputs) > 0:
          input_batch_size = -1
  
          for input in inputs:
              if hasattr(input, "__len__"):
                  input_batch_size = len(input)
              if isinstance(
                  input,
                  (_tensors.TensorListCPU, _tensors.TensorListGPU),
              ):
                  # TensorList inputs have priority for choosing batch size.
                  break
  
          if batch_size == -1:
              if input_batch_size == -1:
                  raise RuntimeError(
                      "Could not deduce 'batch_size' from inputs."
                  )
              batch_size = input_batch_size
  
          if input_batch_size != batch_size:
              raise ValueError(
                  f"Requested batch_size={batch_size}, but input 0 has batch_size={input_batch_size}"
              )
  
      if batch_size == -1:
          raise RuntimeError(
              "Operators with no inputs need to have 'batch_size' parameter specified."
          )
  
      return batch_size
  
imports: import sys
  from nvidia.dali import backend
  from nvidia.dali import internal
  from nvidia.dali import ops
  from nvidia.dali import tensors
  from nvidia.dali import types
  from nvidia.dali.external_source import _prep_data_for_feed_input
label_desc: Use image node_id 39 for calling a global function with example usage: _choose_batch_size(inputs, batch_size) and returns: batch_size