code: def assert_shallow_structure(
      shallow_tree, input_tree, check_types=True
  ):
      """Asserts that `shallow_tree` is a shallow structure of `input_tree`.
  
      That is, this function tests if the `input_tree` structure can be created from
      the `shallow_tree` structure by replacing its leaf nodes with deeper
      tree structures.
  
      Examples:
  
      The following code will raise an exception:
      ```python
        shallow_tree = ["a", "b"]
        input_tree = ["c", ["d", "e"], "f"]
        assert_shallow_structure(shallow_tree, input_tree)
      ```
  
      The following code will not raise an exception:
      ```python
        shallow_tree = ["a", "b"]
        input_tree = ["c", ["d", "e"]]
        assert_shallow_structure(shallow_tree, input_tree)
      ```
  
      Args:
        shallow_tree: an arbitrarily nested structure.
        input_tree: an arbitrarily nested structure.
        check_types: if `True` (default) the sequence types of `shallow_tree` and
          `input_tree` have to be the same.
  
      Raises:
        TypeError: If `shallow_tree` is a sequence but `input_tree` is not.
        TypeError: If the sequence types of `shallow_tree` are different from
          `input_tree`. Only raised if `check_types` is `True`.
        ValueError: If the sequence lengths of `shallow_tree` are different from
          `input_tree`.
      """
      nest_util.assert_shallow_structure(
          nest_util.Modality.DATA, shallow_tree, input_tree, check_types
      )
  
file_path: tensorflow/tensorflow/python/data/util/nest.py
imports: from tensorflow.python.util import nest_util
label_desc: Use image node_id 6 for calling a global function with example usage: assert_shallow_structure(shallow_tree, input_tree, check_types) without return types