if all this is common to gaia-marionette and gaia-perf-marionette, makes probably sense to extract this to an external file that would be sourced in both scripts. I'm open with doing this in another patch.