Code for a stochastic individual-based model in Python