os.umask()

os.umask(new_mask) → old_mask

Set the current numeric umask and return the previous umask.