title: BeautifulSoup Insert HTML data attribute
body: <p>I am stuck trying to insert a new HTML tag in my soup but couldn't  figure out how to proceed. The problem is that I would like the tag to have the attribute "data-toggle" but BeautifulSoup doesn't seem to handle this. </p>
  
  <pre><code>In [79]: tag = soup.new_tag("li")
  
  In [80]: tag
  Out[80]: &lt;li&gt;&lt;/li&gt;
  
  In [81]: tag2 = soup.new_tag("a")
  
  In [82]: tag.append(tag2)
  
  In [83]: tag
  Out[83]: &lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>In [89]: tag = soup.new_tag("li")
  
  In [90]: tag2 = soup.new_tag("a",href="#")
  
  In [91]: tag2 = soup.new_tag("a",data-toggle="pill")
    File "&lt;ipython-input-91-554760df4122&gt;", line 1
      tag2 = soup.new_tag("a",data-toggle="pill")
                             ^
  SyntaxError: keyword can't be an expression
  </code></pre>
  
  <hr>
  
  <p>I have googled this error and ended up on a bs4 doc page (<a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/" rel="nofollow">https://www.crummy.com/software/BeautifulSoup/bs4/doc/</a>) which state that "Some attributes, like the data-* attributes in HTML 5, have names that can’t be used as the names of keyword arguments" and instead recommend to use attrs={"data-foo": "value"}. The point is that it does actually work with some methods (e.g.: find_all) but not with new_tag().</p>
  
  <pre><code>In [97]: tag2 = soup.new_tag("a",attrs={"data-toggle":"pill"}) 
  In [98]: tag2
  Out[98]: &lt;a attrs="{'data-toggle': 'pill'}"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Is this a known bug/limitation or am I missing something ?
  Any hint appreciated !</p>