<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dim_extents(self, *args, **kwargs):
 """ Returns extent tuples of the dimensions in args. .. code-block:: python (tl, tu), (bl, bu) = cube.dim_extents('ntime', 'nbl') or .. code-block:: python (tl, tu), (bl, bu) = cube.dim_upper_extent('ntime,nbl') """



        l = self.dim_lower_extent(*args, **kwargs)
        u = self.dim_upper_extent(*args, **kwargs)

        # Handle sequence and singles differently
        if isinstance(l, collections.Sequence):
            return zip(l, u)
        else:
            return (l, u)