<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def annotate_with_XMLNS(tree, prefix, URI):
 """ Annotates the provided DOM tree with XMLNS attributes and adds XMLNS prefixes to the tags of the tree nodes. :param tree: the input DOM tree :type tree: an ``xml.etree.ElementTree.ElementTree`` or ``xml.etree.ElementTree.Element`` object :param prefix: XMLNS prefix for tree nodes' tags :type prefix: str :param URI: the URI for the XMLNS definition file :type URI: str """

    if not ET.iselement(tree):
        tree = tree.getroot()
    tree.attrib['xmlns:' + prefix] = URI
    iterator = tree.iter()
    next(iterator)  # Don't add XMLNS prefix to the root node
    for e in iterator:
        e.tag = prefix + ":" + e.tag