lazy_generator: Add generate_write
lazy_generator: Add generate_if