title: Filtering function issues in BS4 find_all() statement in Python
body: <p>I'm scraping an HTML webpage. I'm using the BeautifulSoup lib (4.6.0) and Python (3.7) on a Mac (Sierra).</p>
  
  <p>Among other things, I see a bunch of 'div' tags which have class attributes. Some of the 'div' tags come with multiple class attribute values. Now I want to filter based on tag name and class attribute values, e.g. I want to find the 'div' tags that have class='a' but not class='b' (and, yes, some of the div tags come with class='a b').</p>
  
  <p>To get those tags I tried to use a filtering function as mention in the BS4 documentation (<a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-function" rel="nofollow noreferrer">https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-function</a>). I'm under the impression that find_all() passes a bs4 tag element to the function and within the function you can do whatever you would do on a BS4 tag element. That seems not to be true. I get a string and obviously all my BS4 tag element operations raise an exception. </p>
  
  <p>Two questions:</p>
  
  <ol>
  <li>What exactly does find_all() pass to the function and how can the argument be used?</li>
  <li>Besides a function how would otherwise be able to achieve the desired functionality?</li>
  </ol>