@staticmethod
def expand_ellipsis(slices, n_dims):
    'Expands any ellipses into correct number of full-size slices\n\n        @param slices: tuple of slices, integers, or ellipse objects\n        @type slices: tuple\n        @param n_dims: number of dimensions this slice is over\n        @type n_dims: int\n        @return: L{slices} with ellipses replaced by appropriate number of\n                 full-dimension slices\n        @rtype: tuple\n        @raise IndexError: if ellipses specified when already have enough\n                           dimensions\n        '
    if (slices is Ellipsis):
        return tuple([slice(None, None, None) for i in range(n_dims)])
    idx = [i for (i, v) in enumerate(slices) if (v is Ellipsis)]
    if (not idx):
        return slices
    if (len(idx) > 1):
        raise IndexError('Ellipses can only be used once per slice.')
    idx = idx[0]
    extra = ((n_dims - len(slices)) + 1)
    if (extra < 0):
        raise IndexError('too many indices')
    result = ((slices[0:idx] + ((slice(None),) * extra)) + slices[(idx + 1):])
    return result
Expands any ellipses into correct number of full-size slices

@param slices: tuple of slices, integers, or ellipse objects
@type slices: tuple
@param n_dims: number of dimensions this slice is over
@type n_dims: int
@return: L{slices} with ellipses replaced by appropriate number of
         full-dimension slices
@rtype: tuple
@raise IndexError: if ellipses specified when already have enough
                   dimensions
@staticmethod
def expand_ellipsis(slices, n_dims):
    'Expands any ellipses into correct number of full-size slices\n\n        @param slices: tuple of slices, integers, or ellipse objects\n        @type slices: tuple\n        @param n_dims: number of dimensions this slice is over\n        @type n_dims: int\n        @return: L{slices} with ellipses replaced by appropriate number of\n                 full-dimension slices\n        @rtype: tuple\n        @raise IndexError: if ellipses specified when already have enough\n                           dimensions\n        '
    if (slices is Ellipsis):
        return tuple([slice(None, None, None) for i in range(n_dims)])
    idx = [i for (i, v) in enumerate(slices) if (v is Ellipsis)]
    if (not idx):
        return slices
    if (len(idx) > 1):
        raise IndexError('Ellipses can only be used once per slice.')
    idx = idx[0]
    extra = ((n_dims - len(slices)) + 1)
    if (extra < 0):
        raise IndexError('too many indices')
    result = ((slices[0:idx] + ((slice(None),) * extra)) + slices[(idx + 1):])
    return result