To add an XML processing instruction to your document,
use this constructor. It returns a new ProcessingInstruction instance; to place this
into a tree, pass that instance to the parent element's .append() method.
etree.ProcessingInstruction ( target, text=None ):
target
A string containing the target portion of the processing instruction.
text
An optional string containing the rest of the processing instruction. The default value is empty.
Here's an example:
pi = etree.ProcessingInstruction ( 'decor', 'danish,modern,ducksOnWall'
When converted back to XML, this processing instruction would look like this:
<?decor danish,modern,ducksOnWall?>