code: def remove_last(tensors, term_bin_weights):
      new_tensors = []
      for idx, tensor, weights in zip(
          count(), tensors, term_bin_weights
      ):
          if tensor is None:
              result = None
          elif weights is None:
              result = tensor
          else:
              n_dimensions = weights.ndim
              entire_tensor = [slice(None)] * n_dimensions
              higher = []
              for dimension_idx in range(n_dimensions):
                  dim_slices = entire_tensor.copy()
                  dim_slices[dimension_idx] = -1
                  total_sum = np.sum(weights[tuple(dim_slices)])
                  higher.append(True if total_sum == 0 else False)
              result = trim_tensor(tensor, None, higher)
          new_tensors.append(result)
      return new_tensors
  
imports: from itertools import count
  import numpy
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: remove_last(tensors, term_bin_weights) and returns: new_tensors