keras/src/tree/dmtree_impl.py/is_shape_tuple
def is_shape_tuple(x):
    if isinstance(x, (list, tuple)):
        if all(isinstance(e, (int, type(None))) for e in x):
            return True
    return False