def _normalize_shape(shape):
    """Check that the `shape` is safe to be used and return it as a tuple."""

    if isinstance(shape, (int, numpy.integer, int)):
        if shape < 1:
            raise ValueError("shape value must be greater than 0: %d"
                             % shape)
        shape = (shape,)  # N is a shorthand for (N,)
    try:
        shape = tuple(shape)
    except __HOLE__:
        raise TypeError("shape must be an integer or sequence: %r"
                        % (shape,))

    # XXX Get from HDF5 library if possible.
    # HDF5 does not support ranks greater than 32
    if len(shape) > 32:
        raise ValueError(
            "shapes with rank > 32 are not supported: %r" % (shape,))

    return tuple(SizeType(s) for s in shape)
dataset/ETHPy150Open PyTables/PyTables/tables/atom.py/_normalize_shape