def _render_tokens(self, tokens, parent_tag=None):
        itk = 0
        rendered = []
        while itk < len(tokens):
            # Fetch the considered token
            token = tokens[itk]

            # Try to render it according to its type
            if token.is_start_tag:
                # Fetch some data about the current tag
                call_rendering_function = self.bbcodes[token.tag_name].do_render
                tag = self.bbcodes[token.tag_name]

                if tag._options.standalone:
                    rendered.append(call_rendering_function(self, None, token.option, parent_tag))
                else:
                    # First find the closing tag associated with this tag
                    token_end, consume_now = self._find_closing_token(tag, tokens, itk + 1)
                    embedded_tokens = tokens[itk + 1:token_end]

                    # If the end tag should not be consumed, back up one (after processing the embedded tokens)
                    if not consume_now:
                        token_end -= 1

                    if tag._options.render_embedded:
                        inner = self._render_tokens(embedded_tokens, parent_tag=tag)
                    else:
                        inner = self._render_textual_content(
                            ''.join(tk.text for tk in embedded_tokens),
                            tag._options.escape_html, tag._options.replace_links, tag._options.render_embedded)

                    # Strip and replaces newlines if specified in the tag options
                    if tag._options.strip:
                        inner = inner.strip()
                    if tag._options.transform_newlines:
                        inner = inner.replace('\n', self.newline_char)

                    # Append the rendered data
                    rendered.append(call_rendering_function(self, inner, token.option, parent_tag))

                    # Swallow the first trailing newline if necessary
                    if tag._options.swallow_trailing_newline:
                        next_itk = token_end + 1
                        if next_itk < len(tokens) and tokens[next_itk].is_newline:
                            token_end = next_itk

                    # Goto the end tag index
                    itk = token_end
            elif token.is_data:
                replace_specialchars = parent_tag._options.escape_html if parent_tag else True
                replace_links = parent_tag._options.replace_links if parent_tag else True
                replace_smilies = parent_tag._options.render_embedded if parent_tag else True
                rendered.append(self._render_textual_content(token.text, replace_specialchars, replace_links, replace_smilies))
            elif token.is_newline:
                rendered.append(self.newline_char if parent_tag is None else token.text)

            # Goto the next token!
            itk += 1
        return ''.join(rendered)
Given a list of lexical tokens, do the rendering process. During this process, some
dataset/ETHPy150Open ellmetha/django-precise-bbcode/precise_bbcode/bbcode/parser.py/BBCodeParser._render_tokens