code: def selRoulette(individuals, k, fit_attr="fitness"):
      """Select *k* individuals from the input *individuals* using *k*
      spins of a roulette. The selection is made by looking only at the first
      objective of each individual. 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 fit_attr: The attribute of individuals to use as selection criterion
      :returns: A list of selected individuals.
  
      This function uses the :func:`~random.random` function from the python base
      :mod:`random` module.
  
      .. warning::
         The roulette selection by definition cannot be used for minimization
         or when the fitness can be smaller or equal to 0.
      """
  
      s_inds = sorted(
          individuals, key=attrgetter(fit_attr), reverse=True
      )
      sum_fits = sum(
          getattr(ind, fit_attr).values[0] for ind in individuals
      )
      chosen = []
      for i in range(k):
          u = random.random() * sum_fits
          sum_ = 0
          for ind in s_inds:
              sum_ += getattr(ind, fit_attr).values[0]
              if sum_ > u:
                  chosen.append(ind)
                  break
  
      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 5 for calling a global function with example usage: selRoulette(individuals, k, fit_attr) and returns: chosen