removed unused import base64.b64encode
use SystemExit() exception instead of sys.exit