def write(self, data):
if data == '<STR_LIT:\n>':  <EOL><INDENT>return self.stream.write(data)<EOL><DEDENT>else:<EOL><INDENT>bytes_ = <NUM_LIT:0><EOL>for line in data.splitlines(True):<EOL><INDENT>nl = '<STR_LIT>'<EOL>if line.endswith('<STR_LIT:\n>'):  <EOL><INDENT>line = line[:-<NUM_LIT:1>]<EOL>nl = '<STR_LIT:\n>'<EOL><DEDENT>bytes_ += self.stream.write(<EOL>f'<STR_LIT>'<EOL>) or <NUM_LIT:0>  <EOL><DEDENT>return bytes_<EOL><DEDENT>
This could be a bit less clumsy.