def pop(self):
        """Returns a new vector without the last item"""
        if self.length == 0: raise ValueError("Vector is empty")
        if self.length == 1: return self.__class__()
        if self.length - self._tailoff() > 1:
            return self.__class__(self.length-1, self.shift, self.root, self.tail[:-1])

        tail = self._find_container(self.length - 2)
        root = self._pop_tail(self.shift, self.root) or self.__class__._Node()
        shift = self.shift

        if shift > 5 and root.array[1] is None:
            root = root.array[0]
            shift -= 5

        return self.__class__(self.length-1, shift, root, tail)
dataset/ETHPy150Open kachayev/fn.py/fn/immutable/trie.py/Vector.pop/original