def allow_wrap_or_preserved_newline(self, token_text, force_linewrap=False):
    if ((self.opts.wrap_line_length > 0) and (not force_linewrap)):
        line = self.output_lines[(- 1)]
        if (len(line.text) > 0):
            proposed_line_length = (len(''.join(line.text)) + len(token_text))
            if self.output_space_before_token:
                proposed_line_length += 1
            if (proposed_line_length >= self.opts.wrap_line_length):
                force_linewrap = True
    if (((self.opts.preserve_newlines and self.input_wanted_newline) or force_linewrap) and (not self.just_added_newline())):
        self.append_newline(preserve_statement_flags=True)
def allow_wrap_or_preserved_newline(self, token_text, force_linewrap=False):
    if ((self.opts.wrap_line_length > 0) and (not force_linewrap)):
        line = self.output_lines[(- 1)]
        if (len(line.text) > 0):
            proposed_line_length = (len(.join(line.text)) + len(token_text))
            if self.output_space_before_token:
                proposed_line_length += 1
            if (proposed_line_length >= self.opts.wrap_line_length):
                force_linewrap = True
    if (((self.opts.preserve_newlines and self.input_wanted_newline) or force_linewrap) and (not self.just_added_newline())):
        self.append_newline(preserve_statement_flags=True)