def squeeze(shape, n=0):
    """Removes all 1-dimensional entries for all dimensions > ``n``.

    For negative ``n`` the last ``|n|`` dimensions are sequeezed.
    """
    dims = list(shape[:n])
    for dim in shape[n:]:
        if dim > 1:
            dims.append(dim)
    return type(shape)(dims)