'Returns a string or Unicode representation of this tag and
its contents. To get Unicode, pass None for encoding.'

def decode(self, prettyPrint=False, indentLevel=0, eventualEncoding=DEFAULT_OUTPUT_ENCODING):

    attrs = []
    if self.attrs:
        for (key, val) in self.attrs:
            fmt = '%s="%s"'
            if isString(val):
                if (self.containsSubstitutions and (eventualEncoding is not None) and ('%SOUP-ENCODING%' in val)):
                    val = self.substituteEncoding(val, eventualEncoding)
                if ('"' in val):
                    fmt = "%s='%s'"
                    if ("'" in val):
                        val = val.replace("'", '&squot;')
                val = self.BARE_AMPERSAND_OR_BRACKET.sub(self._sub_entity, val)
            if (val is None):
                decoded = key
            else:
                decoded = (fmt % (key, val))
            attrs.append(decoded)
    close = ''
    closeTag = ''
    if self.isSelfClosing:
        close = '    /'
    else:
        closeTag = ('</%s>' % self.name)
    (indentTag, indentContents) = (0, 0)
    if prettyPrint:
        indentTag = indentLevel
        space = ('    ' * (indentTag - 1))
        indentContents = (indentTag + 1)
    contents = self.decodeContents(prettyPrint, indentContents, eventualEncoding)
    if self.hidden:
        s = contents
    else:
        s = []
        attributeString = ''
        if attrs:
            attributeString = ('    ' + '    '.join(attrs))
        if prettyPrint:
            s.append(space)
        s.append(('<%s%s%s>' % (self.name, attributeString, close)))
        if prettyPrint:
            s.append('\n')
        s.append(contents)
        if (prettyPrint and contents and (contents[(-1)] != '\n')):
            s.append('\n')
        if (prettyPrint and closeTag):
            s.append(space)
        s.append(closeTag)
        if (prettyPrint and closeTag and self.nextSibling):
            s.append('\n')
        s = ''.join(s)
    return s
