code: def _make_mapper(driver_addresses, settings, use_gloo, is_elastic):
      # serialised settings do not have a key so we have to copy it and provide it explicitly here
      key = settings.key
  
      def _mapper(index, _):
          yield _task_fn(
              index,
              driver_addresses,
              key,
              settings,
              use_gloo,
              is_elastic,
          )
  
      return _mapper
  
imports: import logging
  import os
  import platform
  import queue
  import sys
  import time
  import warnings
  import pyspark
  from horovod.common.util import gloo_built
  from horovod.runner.util.threads import in_thread
  from horovod.spark.common.util import host_hash
  from horovod.spark.task import task_service
  from horovod.spark.gloo_run import gloo_run, gloo_run_elastic
  from horovod.spark.mpi_run import mpi_run
  from horovod.runner.launch import is_gloo_used, run_controller
  from horovod.runner.common.util import timeout, secret
  from horovod.runner.common.util import settings
  from horovod.runner.elastic import settings
  from horovod.spark.driver import driver_service, host_discovery, job_id
label_desc: Use image node_id 2 for calling a global function with example usage: _make_mapper(driver_addresses, settings, use_gloo, is_elastic) and returns: _mapper