Adds any number of supplied *strings* to `self` (we're a subclass of
        `str` remember) just before the last closing tag and returns a new
        instance of `~htmltag.HTML` with the result.
        Example::

            >>> from htmltag import span, b
            >>> html = span('Test:')
            >>> print(html)
            <span>Test:</span>
            >>> html = html.append(' ', b('appended'))
            >>> print(html)
            <span>Test: <b>appended</b></span>

        In the case of self-closing tags like '<img>' the string will simply be
        appended after the tag::

            >>> from htmltag import img
            >>> image = img(src="http://company.com/image.png")
            >>> print(image.append("Appended string"))
            <img src="http://company.com/image.png">Appended string

        .. note:: Why not update ourselves in-place?  Because we're a subclass
            of `str`; in Python strings are immutable.

def append(self, *strings):
        """
        Adds any number of supplied *strings* to `self` (we're a subclass of
        `str` remember) just before the last closing tag and returns a new
        instance of `~htmltag.HTML` with the result.
        Example::

            >>> from htmltag import span, b
            >>> html = span('Test:')
            >>> print(html)
            <span>Test:</span>
            >>> html = html.append(' ', b('appended'))
            >>> print(html)
            <span>Test: <b>appended</b></span>

        In the case of self-closing tags like '<img>' the string will simply be
        appended after the tag::

            >>> from htmltag import img
            >>> image = img(src="http://company.com/image.png")
            >>> print(image.append("Appended string"))
            <img src="http://company.com/image.png">Appended string

        .. note:: Why not update ourselves in-place?  Because we're a subclass
            of `str`; in Python strings are immutable.
        """
        close_tag_start = self.rfind('</')
        if self.tagname: # More accurate
            close_tag_start = self.rfind('</'+self.tagname)
        if close_tag_start == -1: # Couldn't find closing tag
            return self + "".join(strings) # Just tack on to the end
        ending = self[close_tag_start:]
        beginning = self[:close_tag_start]
        if self.tagname: # Preserve it
            tagname = self.tagname
            new = HTML(beginning + "".join(strings) + ending)
            new.tagname = tagname
            return new
        else:
            return HTML(beginning + "".join(strings) + ending)