In some of the code, I have conditions on os.getuid() == 0. Does this mean the script is checking if the user is root and needs "sudo"
In a nutshell, yes. On systems where this makes sense at all, UID 0 implies the user is root, and that is what the code is checking.