code: def _download(tasks, max_videos, skip_failures, quiet):
      downloaded = {}
      errors = {}
  
      with fou.ProgressBar(total=max_videos, iters_str="videos") as pb:
          for task in tasks:
              idx, url, video_path, error, warnings = _do_download(task)
  
              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 5 for calling a global function with example usage: _download(tasks, max_videos, skip_failures, quiet) and returns: downloaded,  errors, downloaded,  errors