code: def choose_pool(mpi=False, processes=1, **kwargs):
      
  
      if mpi:
          if not MPIPool.enabled():
              raise SystemError("Tried to run with MPI but MPIPool not enabled.")
  
          pool = MPIPool(**kwargs)
          if not pool.is_master():
              pool.wait()
              sys.exit(0)
  
          log.info("Running with MPI on {0} cores".format(pool.size))
          return pool
  
      elif processes != 1 and MultiPool.enabled():
          log.info("Running with MultiPool on {0} cores".format(processes))
          return MultiPool(processes=processes, **kwargs)
  
      else:
          log.info("Running with SerialPool")
          return SerialPool(**kwargs)
docs: Choose between the different pools given options from, e.g., argparse.
  
      Parameters
      ----------
      mpi : bool, optional
          Use the MPI processing pool, :class:`~schwimmbad.mpi.MPIPool`. By
          default, ``False``, will use the :class:`~schwimmbad.serial.SerialPool`.
      processes : int, optional
          Use the multiprocessing pool,
          :class:`~schwimmbad.multiprocessing.MultiPool`, with this number of
          processes. By default, ``processes=1``, will use the
          :class:`~schwimmbad.serial.SerialPool`.
      **kwargs
          Any additional kwargs are passed in to the pool class initializer
          selected by the arguments.