code: def write_wrapped(self, s, extra_room=0):
          
          if self.room < len(s) + extra_room:
              self.write_soft_break()
          self.write_str(s)
docs: Add a soft line break if needed, then write s.