et = etree.XML(
    '<root xmlns="foo" xmlns:stuff="bar"><bar><stuff:baz /></bar></root>')
etree.tostring(et, encoding=str)
et.xpath('f:bar', namespaces={'b': 'bar', 'f': 'foo'})
Good python XML parser to work with namespace heavy documents