<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dict_to_xml(spec, full_document=False):
 """ Convert dict to XML Args: spec(dict):
 dict to convert full_document(bool):
 whether to add XML headers Returns: lxml.etree.Element: XML tree """


    middle = xmltodict.unparse(spec, full_document=full_document, pretty=True)
    return lxml.etree.fromstring(middle)