Why?
1. What is so bad about python in specific?
2. If you worry about root privileges, required for modifying the host file, you can use app armor to put the thing on a leash
Modifying system hosts configuration requires privileged file system access.
The mindset here should be default deny.
With the proper permissions something like this should be ok, but I'd tread lightly. Especially with something that dynamically updates your hosts file.
Naturally it's on the user to properly configure the permissions.
I'm not saying this isn't a worthy project, I'm just adding to the discussion on why people should be cautious when running scripts with root permissions.