Support both BS4 and BeautifulSoup

BS4 and BeautifulSoup differ in the way the class attribute is defined.
In BS4, tag.class is a list of classes whereas in BeautifulSoup
tag.class is a string.

This commit abstract the class checker to support any of the two
versions.