code: def reference_packing(trim_fn=None):
      no_trim = lambda x: {k: list(v) for k, v in x.items()}
      trim_fn = trim_fn or no_trim
      outputs = [
          INPUTS_PACKED,
          INPUTS_POSITION,
          INPUTS_SEGMENTATION,
          TARGETS_PACKED,
          TARGETS_POSITION,
          TARGETS_SEGMENTATION,
      ]
      for i, i_pos, i_seg, t, t_pos, t_seg in zip(*outputs):
          output = trim_fn(
              {
                  "inputs": i,
                  "inputs_position": i_pos,
                  "inputs_segmentation": i_seg,
              }
          )
          output.update(
              trim_fn(
                  {
                      "targets": t,
                      "targets_position": t_pos,
                      "targets_segmentation": t_seg,
                  }
              )
          )
          yield output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gzip
  import io
  import os
  import tempfile
  from builtins import bytes
  from tensor2tensor.data_generators import generator_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: reference_packing(trim_fn) without return types