Common code for cultural transmission models in Python