<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def recalculate_extents(self):
 """Adjust x, y, cx, and cy to incorporate all contained shapes. This would typically be called when a contained shape is added, removed, or its position or size updated. This method is recursive "upwards" since a change in a group shape can change the position and size of its containing group. """

        if not self.tag == qn('p:grpSp'):
            return

        x, y, cx, cy = self._child_extents

        self.chOff.x = self.x = x
        self.chOff.y = self.y = y
        self.chExt.cx = self.cx = cx
        self.chExt.cy = self.cy = cy
        self.getparent().recalculate_extents()