<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shape(self):
 """Total spaces per axis, computed recursively. The recursion ends at the fist level that does not have a shape. Examples -------- (2,) (3, 2) If the space is a "pure" product space, shape recurses all the way into the components: (3, 2) """

        if len(self) == 0:
            return ()
        elif self.is_power_space:
            try:
                sub_shape = self[0].shape
            except AttributeError:
                sub_shape = ()
        else:
            sub_shape = ()

        return (len(self),) + sub_shape