code: def _map_promise(map_fn, all_inputs):
      """Map the function into each element and resolve the promise."""
      all_promises = tree_utils.map_structure(
          map_fn, all_inputs
      )  # Apply the function
      res = tree_utils.map_structure(
          lambda p: p.get(), all_promises
      )  # Wait promises
      return res
  
imports: from __future__ import annotations
  import concurrent.futures
  import dataclasses
  import functools
  import hashlib
  import typing
  from typing import Any, Dict, Iterator, Optional, Tuple, Union
  import uuid
  from absl import logging
  from etils import epath
  import promise
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.download import checksums
  from tensorflow_datasets.core.download import downloader
  from tensorflow_datasets.core.download import extractor
  from tensorflow_datasets.core.download import kaggle
  from tensorflow_datasets.core.download import resource
  from tensorflow_datasets.core.download import util
  from tensorflow_datasets.core.utils import shard_utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
label_desc: Use image node_id 6 for calling a global function with example usage: _map_promise(map_fn, all_inputs) and returns: res