code: def map_structure(func, *structure, **check_types_dict):
      """Applies `func` to each entry in `structure` and returns a new structure.
  
      Applies `func(x[0], x[1], ...)` where x[i] is an entry in
      `structure[i]`.  All structures in `structure` must have the same arity,
      and the return value will contain the results in the same structure.
  
      Args:
        func: A callable that accepts as many arguments are there are structures.
        *structure: scalar, or tuple or list of constructed scalars and/or other
          tuples/lists, or scalars.  Note: numpy arrays are considered scalars.
        **check_types_dict: only valid keyword argument is `check_types`. If set to
          `True` (default) the types of iterables within the structures have to be
          same (e.g. `map_structure(func, [1], (1,))` raises a `TypeError`
          exception). To allow this set this argument to `False`.
  
      Returns:
        A new structure with the same arity as `structure`, whose values correspond
        to `func(x[0], x[1], ...)` where `x[i]` is a value in the corresponding
        location in `structure[i]`. If there are different sequence types and
        `check_types` is `False` the sequence types of the first structure will be
        used.
  
      Raises:
        TypeError: If `func` is not callable or if the structures do not match
          each other by depth tree.
        ValueError: If no structure is provided or if the structures do not match
          each other by type.
        ValueError: If wrong keyword arguments are provided.
      """
      return nest_util.map_structure(
          nest_util.Modality.DATA, func, *structure, **check_types_dict
      )
  
file_path: tensorflow-upstream/tensorflow/python/data/util/nest.py
imports: from tensorflow.python.util import nest_util
label_desc: Use image node_id 5 for calling a global function with example usage: map_structure(func) and returns: nest_util