Is this logging left over from debug? I don't see that we need it, and removing it allows us to put this function on a single line. Also, my previous comment about indentation has been missed. Generally, for execute scripts that span multiple lines we start with zero indentation as any indentation is retained in the script. See https://github.com/mozilla-b2g/gaia/blob/e7f4ac493dbf7f3c92553d78b6a5c11215b16bae/tests/python/gaia-ui-tests/gaiatest/gaia_test.py#L468 as an example.

Note that these are just nits regarding coding style. The code itself looks good.