<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def insert(self, card, indice=-1):
 """ Insert a given card into the stack at a given indice. :arg Card card: The card to insert into the stack. :arg int indice: Where to insert the given card. """

        self_size = len(self.cards)

        if indice in [0, -1]:
            if indice == -1:
                self.cards.append(card)
            else:
                self.cards.appendleft(card)
        elif indice != self_size:
            half_x, half_y = self.split(indice)
            self.cards = list(half_x.cards) + [card] + list(half_y.cards)