Return the effective group id of the current process. This corresponds to the “set id” bit on the file being executed in the current process.
os.getegid()