<p>I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema.  How do I do this in Python?</p>

<p>I'd prefer something using the standard library, but I can install a third-party package if necessary.</p>

lxml provides etree.DTD
from the tests on
http://lxml.de/api/lxml.tests.test_dtd-pysrc.html
```
```
...
root = etree.XML(_bytes("<b/>")) 
dtd = etree.DTD(BytesIO("<!ELEMENT b EMPTY>")) 
self.assert_(dtd.validate(root))
```
```