def drop_privs(username):
    uid = pwd.getpwnam(username).pw_uid
    gid = pwd.getpwnam(username).pw_gid
    os.setgroups([])
    os.setgid(gid)
    os.setuid(uid)
    try:
        os.setuid(0)
    except __HOLE__:
        pass
    else:
        raise AssertionError("setuid(0) succeeded after attempting to drop privileges")

# A decorator to ignore "broken pipe" errors.
dataset/ETHPy150Open arlolra/flashproxy/flashproxy/proc.py/drop_privs