code: def _assert_ds_types(nested_ds: Tree[TensorflowElem]) -> None:
      """Assert all inputs are from valid types."""
      for el in tf.nest.flatten(nested_ds):
          if not (
              isinstance(el, (tf.Tensor, tf.RaggedTensor))
              or isinstance(el, tf.data.Dataset)
          ):
              nested_types = tree_utils.map_structure(type, nested_ds)
              raise TypeError(
                  "Arguments to as_numpy must be tf.Tensors or tf.data.Datasets. "
                  f"Got: {nested_types}."
              )
  
imports: from __future__ import annotations
  import collections.abc
  import functools
  import typing
  from typing import Any, Callable, Iterable, Iterator, Union
  from etils import enp
  from etils.etree import nest
  import numpy
  from tensorflow_datasets.core import logging
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _assert_ds_types(nested_ds) without return types