keras/src/trainers/data_adapters/__init__.py/is_tf_dataset
def is_tf_dataset(x):
    if hasattr(x, "__class__"):
        for parent in x.__class__.__mro__:
            if parent.__name__ in (
                "DatasetV2",
                "DistributedDataset",
            ) and "tensorflow.python." in str(parent.__module__):
                return True
    return False