code: def _log_exception(fn):
      """Logs the exceptions from a `ThreadPoolExecutor`."""
  
      @functools.wraps(fn)
      def decorated(*args, **kwargs):
          try:
              return fn(*args, **kwargs)
          except Exception:  # pylint: disable=broad-except
              err_str = traceback.format_exc()
              logging.error(
                  f"Exception occurred for {args}, {kwargs}:\n"
                  + err_str
              )
              raise
  
      return decorated
  
file_path: datasets/tensorflow_datasets/scripts/documentation/script_utils.py
imports: import concurrent.futures
  import functools
  import itertools
  import multiprocessing
  import os
  import traceback
  from typing import Any, Callable, List, Optional, TypeVar
  from absl import app
  from absl import logging
  import tensorflow_datasets
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: _log_exception(fn) and returns: decorated, fn