Use BeautifulSoup 4, which is the newer, maintained version
StringIO => BytesIO for Python 3 compatibility