Stimulus evoked functional magnetic resonance imaging (fMRI) has become an essential experimental tool in neuroscience over the past decades. As fMRI measurements are complex, expensive, and often target low-amplitude effects, the statistical optimization of stimulus sequences for specific experimental targets plays an integral role in the experiment design process. We provide an extremely flexible framework to perform such optimizations using the genetic algorithm introduced by Wager and Nichols (2001) and improved by Kao et al. (2009). There are a number of existing implementations of this algorithm, predominantly in MATLAB. Our Python implementation improves on many aspects of existing solutions, including higher parametrization, the availability of an API, and a detailed documentation thereof. Because of its modular structure, our implementation is highly adaptable for specific use cases in clinical and preclinical fMRI. Nevertheless, we also provide an easy to use default algorithm, with widely applicable and properly cited presets. The implementation allows full model (design matrix construction, covariance matrix computation) as well as fitness measure specification.