code: def selTournament(individuals, k, tournsize, fit_attr="fitness"):
      """Select the best individual among *tournsize* randomly chosen
      individuals, *k* times. The list returned contains
      references to the input *individuals*.
  
      :param individuals: A list of individuals to select from.
      :param k: The number of individuals to select.
      :param tournsize: The number of individuals participating in each tournament.
      :param fit_attr: The attribute of individuals to use as selection criterion
      :returns: A list of selected individuals.
  
      This function uses the :func:`~random.choice` function from the python base
      :mod:`random` module.
      """
      chosen = []
      for i in range(k):
          aspirants = selRandom(individuals, tournsize)
          chosen.append(max(aspirants, key=attrgetter(fit_attr)))
      return chosen
  
file_path: deap/deap/tools/selection.py
imports: import random
  import numpy
  from functools import partial
  from operator import attrgetter
label_desc: Use image node_id 4 for calling a global function with example usage: selTournament(individuals, k, tournsize, fit_attr) and returns: chosen