[sgade] Added write function.