Python implementation of a genetic algorithm