code: def get_html_output(self):
          
          def html_splitlines(lines):
              # this cool function was taken from trac.
              # http://projects.edgewall.com/trac/
              open_tag_re = re.compile(r'<(\w+)(\s.*)?[^/]?>')
              close_tag_re = re.compile(r'</(\w+)>')
              open_tags = []
              for line in lines:
                  for tag in open_tags:
                      line = tag.group(0) + line
                  open_tags = []
                  for tag in open_tag_re.finditer(line):
                      open_tags.append(tag)
                  open_tags.reverse()
                  for ctag in close_tag_re.finditer(line):
                      for otag in open_tags:
                          if otag.group(1) == ctag.group(1):
                              open_tags.remove(otag)
                              break
                  for tag in open_tags:
                      line += '</%s>' % tag.group(1)
                  yield line
  
          if self.error:
              return escape(self.raw).splitlines()
          return list(html_splitlines(self.out.getvalue().splitlines()))
docs: Return line generator.