def is_writable(path):
 if os.path.exists(path):
  return os.access(path, os.W_OK)
 else:
  return os.access(os.path.dirname(path), os.W_OK)

def is_writable ( path ) : if os . path . exists ( path ) : return os . access ( path , os . W_OK ) else : return os . access ( os . path . dirname ( path ) , os . W_OK )
predicate that returns true if the sheet is writeable .