I'm using BeautifulSoup's lxml parser to parse some html. However, it's not being parsed as it's written. For instance, the following code:

```
import bs4

my_html = '''
<html>
<body>
<B>
<P>
Hello, I am some bolded text
</P>
</B>
</body>
</html>
'''

soup = bs4.BeautifulSoup(my_html, 'lxml')
print soup.prettify()

```

will print:

```
<html>
 <body>
  <b>
  </b>
  <p>
   Hello, I am some bolded text
  </p>
 </body>
</html>

```

You can see that somehow the `<B>` tag from `my_html` gets closed off before the `<p>` tag in the prettified version, even though it should be closed off after the `</p>`. Any ideas about what might be going on? I'm totally baffled.