Use sys.exit to set exit code