code: def trim_right(x):
      x = {k: list(v) for k, v in x.items()}
      while all(x.values()) and not any(i[-1] for i in x.values()):
          _ = [i.pop() for i in x.values()]
      return x
  
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 2 for calling a global function with example usage: trim_right(x) and returns: x