code: def wait_and_raise_from_futures(futures):
      """
      Returns the collected futures after all the futures
      have finished and do not indicate any exceptions.
      """
      wait(futures)
      raise_exception_from_futures(futures)
      return futures
  
imports: from threading import Lock
  from asyncio import InvalidStateError
  from cuml.internals.import_utils import check_min_dask_version
  from cuml.common import device_of_gpu_matrix
  from dask.distributed import default_client, wait
  import time
  import random
  import dask
  import logging
  import os
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 10 for calling a global function with example usage: wait_and_raise_from_futures(futures) and returns: futures