<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pop(self: BoardT) -> Move: """ Restores the previous position and returns the last move from the stack. :raises: :exc:`IndexError` if the stack is empty. """

        move = self.move_stack.pop()
        self._stack.pop().restore(self)
        return move