Code fails with `NameError: name 'exit' is not defined`. Trivial fix is to `import sys` and call `sys.exit(1)`