<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reshape(self, *shape):
 """ Reshape the Series object Cannot change the last dimension. Parameters shape: one or more ints New shape """

        if prod(self.shape) != prod(shape):
            raise ValueError("Reshaping must leave the number of elements unchanged")

        if self.shape[-1] != shape[-1]:
            raise ValueError("Reshaping cannot change the size of the constituent series (last dimension)")

        if self.labels is not None:
            newlabels = self.labels.reshape(*shape[:-1])
        else:
            newlabels = None

        return self._constructor(self.values.reshape(shape), labels=newlabels).__finalize__(self, noprop=('labels',))