'Returns a string or Unicode representation of this document.
To get Unicode, pass None for encoding.'

def decode(self, pretty_print=False, eventual_encoding=DEFAULT_OUTPUT_ENCODING, formatter='minimal'):

    if self.is_xml:
        encoding_part = ''
        if (eventual_encoding != None):
            encoding_part = ('    encoding="%s"' % eventual_encoding)
        prefix = (u'<?xml    version="1.0"%s?>\n' % encoding_part)
    else:
        prefix = u''
    if (not pretty_print):
        indent_level = None
    else:
        indent_level = 0
    return (prefix + super(BeautifulSoup, self).decode(indent_level, eventual_encoding, formatter))
