code: def _extract_partitions(dask_obj, client=None):
      client = default_client() if client is None else client
  
      # dask.dataframe or dask.array
      if isinstance(
          dask_obj,
          (daskArray, daskSeries, daskDataFrame, dcSeries, dcDataFrame),
      ):
          persisted = client.persist(dask_obj)
          parts = futures_of(persisted)
  
      # iterable of dask collections (need to colocate them)
      elif isinstance(dask_obj, Sequence):
          # NOTE: We colocate (X, y) here by zipping delayed
          # n partitions of them as (X1, y1), (X2, y2)...
          # and asking client to compute a single future for
          # each tuple in the list
          dela = [np.asarray(d.to_delayed()) for d in dask_obj]
  
          # TODO: ravel() is causing strange behavior w/ delayed Arrays which are
          # not yet backed by futures. Need to investigate this behavior.
          # ref: https://github.com/rapidsai/cuml/issues/2045
          raveled = [d.ravel() for d in dela]
          parts = client.compute([p for p in zip(*raveled)])
  
      yield wait(parts)
  
      key_to_part = [(part.key, part) for part in parts]
      who_has = yield client.who_has(parts)
  
      raise gen.Return(
          [(first(who_has[key]), part) for key, part in key_to_part]
      )
  
file_path: cuml/python/cuml/dask/common/part_utils.py
imports: from cuml.dask.common.utils import parse_host_port
  from dask_cudf.core import Series
  from cuml.internals.safe_imports import gpu_only_import_from
  from dask.dataframe import Series
  from dask.dataframe import DataFrame
  from dask.array.core import Array
  from toolz import first
  from dask.distributed import futures_of, default_client, wait
  from collections.abc import Sequence
  from tornado import gen
  from functools import reduce
  from collections import OrderedDict
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 7 for calling a global function with example usage: _extract_partitions(dask_obj, client) without return types