scripts/karma: move code to helpers
scripts/karma: disallow changes to own karma