def flipwritable(fn, mode=None):
 if os.access(fn, os.W_OK):
  return None
 old_mode = os.stat(fn).st_mode
 os.chmod(fn, (stat.S_IWRITE | old_mode))
 return old_mode

def flipwritable ( fn , mode = None ) : if os . access ( fn , os . W_OK ) : return None old_mode = os . stat ( fn ) . st_mode os . chmod ( fn , ( stat . S_IWRITE | old_mode ) ) return old_mode
flip the writability of a file and return the old mode .