def remove_axes_from_shape(shape, axis):
    """
    Given a shape tuple as the first input, construct a new one by  removing
    that particular axis from the shape and all preceeding axes. Negative axis
    numbers are permittted, where the axis is relative to the last axis.
    """
    if len(shape) == 0:
        return shape
    if axis < 0:
        axis = len(shape) + axis
        return shape[:axis] + shape[axis+1:]
    if axis >= len(shape):
        axis = len(shape)-1
    shape = shape[axis+1:]
    return shape