code: def _download_multi(
      tasks, max_videos, skip_failures, quiet, num_workers, use_threads
  ):
      downloaded = {}
      errors = {}
  
      with fou.ProgressBar(total=max_videos, iters_str="videos") as pb:
          if use_threads:
              ctx = multiprocessing.dummy
          else:
              ctx = fou.get_multiprocessing_context()
  
          with ctx.Pool(num_workers) as pool:
              for (
                  idx,
                  url,
                  video_path,
                  error,
                  warnings,
              ) in pool.imap_unordered(_do_download, tasks):
                  if warnings and not quiet:
                      for msg in warnings:
                          logger.warning(msg)
  
                  if error:
                      msg = "Failed to download video '%s': %s" % (
                          url,
                          error,
                      )
                      if skip_failures:
                          if not quiet:
                              logger.warning(msg)
                      else:
                          raise ValueError(msg)
  
                      errors[idx] = error
                      pb.draw()
                  else:
                      pb.update()
                      downloaded[idx] = video_path
                      if len(downloaded) >= max_videos:
                          return downloaded, errors
  
      return downloaded, errors
  
imports: import importlib
  import itertools
  import logging
  import multiprocessing.dummy
  import os
  import numpy
  import eta.core.utils
  import eta.core.video
  import fiftyone.core.utils
label_desc: Use image node_id 6 for calling a global function with example usage: _download_multi(tasks, max_videos, skip_failures, quiet, num_workers, use_threads) and returns: downloaded,  errors, downloaded,  errors