code: def run_marionette_script(script, chrome=False, async=False, host='localhost', port=2828):
      
      m = DeviceHelper.getMarionette(host, port)
      m.start_session()
      if chrome:
          m.set_context(marionette.Marionette.CONTEXT_CHROME)
      if not async:
          result = m.execute_script(script)
      else:
          result = m.execute_async_script(script)
      m.delete_session()
      return result
docs: Create a Marionette instance and run the provided script