mat: modernisation

Modernises the MAT formula a little, especially around the handling of the Python elements.
I wondered why that dependency wasn't conditional on OS X version, but I wasn't sure if there was some reason I was unaware of so I left it. Shall change now. Thanks :smiley_cat: