code: def bb_pad(
      samples: list,  # List of 3-tuples like (image, bounding_boxes, labels)
      pad_idx=0,  # Label that will be used to pad each list of labels
  ):
      "Function that collects `samples` of labelled bboxes and adds padding with `pad_idx`."
      samples = [(s[0], *clip_remove_empty(*s[1:])) for s in samples]
      max_len = max([len(s[2]) for s in samples])
  
      def _f(img, bbox, lbl):
          bbox = torch.cat(
              [bbox, bbox.new_zeros(max_len - bbox.shape[0], 4)]
          )
          lbl = torch.cat(
              [lbl, lbl.new_zeros(max_len - lbl.shape[0]) + pad_idx]
          )
          return img, bbox, lbl
  
      return [_f(*s) for s in samples]
  
imports: from __future__ import annotations
  from ..torch_basics import *
  from ..data.all import *
  from .core import *
  import types
label_desc: Use image node_id 3 for calling a global function with example usage: bb_pad(samples, pad_idx) and returns: unknown, img,  bbox,  lbl