Having the python versions between before_script and script is alphabetically good, but it has no sense in fact. It presumes you know where to find the keys ;)

Why not doing the logical order? Something in the idea of:

before
during
after

Do you feel better with the alphabetical or the logical order?