code: def bit_flip_mutation(random, candidate, args):
      
      rate = args.setdefault('mutation_rate', 0.1)
      mutant = copy.copy(candidate)
      if len(mutant) == len([x for x in mutant if x in [0, 1]]):
          for i, m in enumerate(mutant):
              if random.random() < rate:
                  mutant[i] = (m + 1) % 2
      return mutant
docs: Return the mutants produced by bit-flip mutation on the candidates.
  
      This function performs bit-flip mutation. If a candidate solution contains
      non-binary values, this function leaves it unchanged.
  
      .. Arguments:
         random -- the random number generator object
         candidate -- the candidate solution
         args -- a dictionary of keyword arguments
  
      Optional keyword arguments in args:
      
      - *mutation_rate* -- the rate at which mutation is performed (default 0.1)
      
      The mutation rate is applied on a bit by bit basis.