def array_shape(x) -> tuple[int, ...]:
    """Return the shape of 'x'."""
    try:
        return tuple(map(int, x.shape))
    except AttributeError:
        raise TypeError(f"No array shape defined for type {type(x)}")