Support BeautifulSoup 4 or 3 for compatibility

Cleaned up beautiful soup pull request