Nit: When using """ the contents will be parsed as JavaScript, so I usually follow JavaScript's indentation rules, such as:

```python
        self.marionette.execute_script("""
var keyboard = navigator.mozKeyboard || navigator.mozInputMethod;
keyboard.removeFocus();""")
```