<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_wrapped(self, s, extra_room=0):
 """Add a soft line break if needed, then write s."""

        if self.room < len(s) + extra_room:
            self.write_soft_break()
        self.write_str(s)