code: def migPipe(deme, k, pipein, pipeout, selection, replacement=None):
      """Migration using pipes between initialized processes. It first selects
      *k* individuals from the *deme* and writes them in *pipeout*. Then it
      reads the individuals from *pipein* and replace some individuals in the
      deme. The replacement strategy shall not select twice the same individual.
  
      :param deme: A list of individuals on which to operate migration.
      :param k: The number of individuals to migrate.
      :param pipein: A :class:`~multiprocessing.Pipe` from which to read
                     immigrants.
      :param pipeout: A :class:`~multiprocessing.Pipe` in which to write
                      emigrants.
      :param selection: The function to use for selecting the emigrants.
      :param replacement: The function to use to select which individuals will
                          be replaced. If :obj:`None` (default) the individuals
                          that leave the population are directly replaced.
      """
      emigrants = selection(deme, k)
      if replacement is None:
          # If no replacement strategy is selected, replace those who migrate
          immigrants = emigrants
      else:
          # Else select those who will be replaced
          immigrants = replacement(deme, k)
  
      pipeout.send(emigrants)
      buf = pipein.recv()
  
      for place, immigrant in zip(immigrants, buf):
          indx = deme.index(place)
          deme[indx] = immigrant
  
file_path: deap/examples/ga/onemax_island.py
imports: import array
  import random
  import numpy
  from collections import deque
  from multiprocessing import Event, Pipe, Process
  from deap import algorithms
  from deap import base
  from deap import creator
  from deap import tools
label_desc: Use image node_id 2 for calling a global function with example usage: migPipe(deme, k, pipein, pipeout, selection, replacement) without return types