def METHOD_NAME(self, instream=None, outstream=None):
    if instream and outstream:
        self.ins, self.outs = instream, outstream
    self.is_return = False
    self.return_buf = ''
    def write(char):
        # all of this is to support literal regular expressions.
        # sigh
        if char in 'return':
            self.return_buf += char
            self.is_return = self.return_buf == 'return'
        else:
            self.return_buf = ''
            self.is_return = self.is_return and char < '!'
        self.outs.write(char)
        if self.is_return:
            self.return_buf = ''
    read = self.ins.read
    space_strings = "abcdefghijklmnopqrstuvwxyz" \
                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\\"
    self.space_strings = space_strings
    starters, enders = '{[(+-', '}])+-/' + self.quote_chars
    newlinestart_strings = starters + space_strings + self.quote_chars
    newlineend_strings = enders + space_strings + self.quote_chars
    self.newlinestart_strings = newlinestart_strings
    self.newlineend_strings = newlineend_strings
    do_newline = False
    do_space = False
    escape_slash_count = 0
    in_quote = ''
    quote_buf = []
    previous = ';'
    previous_non_space = ';'
    next1 = read(1)
    while next1:
        next2 = read(1)
        if in_quote:
            quote_buf.append(next1)
            if next1 == in_quote:
                numslashes = 0
                for c in reversed(quote_buf[:-1]):
                    if c != '\\':
                        break
                    numslashes += 1
                if numslashes % 2 == 0:
                    in_quote = ''
                    write(''.join(quote_buf))
        elif next1 in '\r\n':
            next2, do_newline = self.newline(
                previous_non_space, next2, do_newline)
        elif next1 < '!':
            if (previous_non_space in space_strings or previous_non_space > '~') \
                    and (next2 in space_strings or next2 > '~'):
                do_space = True
            elif previous_non_space in '-+' and next2 == previous_non_space:
                # protect against + ++ or - -- sequences
                do_space = True
            elif self.is_return and next2 == '/':
                # returning a regex...
                write(' ')
        elif next1 == '/':
            if do_space:
                write(' ')
            if next2 == '/':
                # Line comment: treat it as a newline, but skip it
                next2 = self.line_comment(next1, next2)
                next1 = '\n'
                next2, do_newline = self.newline(
                    previous_non_space, next2, do_newline)
            elif next2 == '*':
                self.block_comment(next1, next2)
                next2 = read(1)
                if previous_non_space in space_strings:
                    do_space = True
                next1 = previous
            else:
                if previous_non_space in '{(,=:[?!&|;' or self.is_return:
                    self.regex_literal(next1, next2)
                    # hackish: after regex literal next1 is still /
                    # (it was the initial /, now it's the last /)
                    next2 = read(1)
                else:
                    write('/')
        else:
            if do_newline:
                write('\n')
                do_newline = False
                do_space = False
            if do_space:
                do_space = False
                write(' ')
            write(next1)
            if next1 in self.quote_chars:
                in_quote = next1
                quote_buf = []
        if next1 >= '!':
            previous_non_space = next1
        if next1 == '\\':
            escape_slash_count += 1
        else:
            escape_slash_count = 0
        previous = next1
        next1 = next2