def bootstrapify(self):
        """Add bootstrap cdn to headers of html"""
        if self.__htmltree is None:
            #raise Exception("HtmlTree has not been made yet")
            self.__make_tree()

        # add bootstrap cdn to head
        self.__htmltree.find('head').append(
            E.LINK(rel="stylesheet",
                   href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css",
                   type="text/css"))

        # center images
        for img_parent in self.__htmltree.xpath("//img/.."):
            # the space before the class to insert is CRITICAL!
            img_parent.attrib["class"] += " text-center"

        # make images responsive
        for img in self.__htmltree.xpath("//img"):
            # the space before the class to insert is CRITICAL!
            img.attrib["class"] += " img-responsive"
Add bootstrap cdn to headers of html