def _truncate_after_last(self, entry):
    if isinstance(entry, dict):
        return {k: self._truncate_after_last(v) for (k, v) in entry.items()}
    if isinstance(entry, tuple):
        return new_tuple(type(entry), (self._truncate_after_last(v) for v in entry))
    elif isinstance(entry, (to.Tensor, np.ndarray)):
        if (entry.shape[0] == (self.length + 1)):
            return entry[:(- 1), ...]
    elif isinstance(entry, list):
        if (len(entry) == (self.length + 1)):
            return entry[:(- 1)]
    return entry
def _truncate_after_last(self, entry):
    if isinstance(entry, dict):
        return {k: self._truncate_after_last(v) for (k, v) in entry.items()}
    if isinstance(entry, tuple):
        return new_tuple(type(entry), (self._truncate_after_last(v) for v in entry))
    elif isinstance(entry, (to.Tensor, np.ndarray)):
        if (entry.shape[0] == (self.length + 1)):
            return entry[:(- 1), ...]
    elif isinstance(entry, list):
        if (len(entry) == (self.length + 1)):
            return entry[:(- 1)]
    return entry