soup = BeautifulSoup.BeautifulSoup(doc)
for tag in soup.recursiveChildGenerator():
    if isinstance(tag, BeautifulSoup.Tag) and tag.name in ('a', 'b', 'i'):
        pass
Using Beautiful Soup to strip html tags from a string