def METHOD_NAME(filename, outputfile):
    try:
        dom = parse(filename)
    except Exception as err:
        print("error while parsing %s: %s" % (filename, err))
        return
    tasks = dom.getElementsByTagName("task")
    for task in tasks:
        textnode = task.getElementsByTagName("title")[0].childNodes[0]
        nodevalue = textnode.nodeValue
        replaced_title = re.sub('[^ \n\t]', 'm', textnode.nodeValue)
        textnode.nodeValue = "%s %s" % (task.getAttribute('id'),
                                        replaced_title)
        contentnode = task.getElementsByTagName("content")
        if len(contentnode) == 0:
            continue
        if contentnode[0].childNodes != []:
            contentnode = contentnode[0].childNodes[0]
            contentnode.nodeValue = re.sub('[^ \n\t]', 'm',
                                           contentnode.nodeValue)
    taglist = dom.getElementsByTagName("taglist")
    tags = taglist[0].getElementsByTagName("tag")
    tag_dict = {}
    for tag in tags:
        tag_dict[tag.getAttribute("name")] = tag.getAttribute("id")
    for tag in tags:
        tag.setAttribute("name", tag.getAttribute("id"))
        if tag.getAttribute('parent') != '':
            tag.setAttribute("parent",
                             tag_dict.get(tag.getAttribute("parent"), 'unk'))
    searchlist = dom.getElementsByTagName("searchlist")
    searches = searchlist[0].getElementsByTagName("savedSearch")
    search_dict = {}
    for search in searches:
        search_dict[search.getAttribute("name")] = search.getAttribute("id")
    for search in searches:
        search.setAttribute("query", "anon")
        search.setAttribute("name", search.getAttribute("id"))
        if search.getAttribute('parent') != 'search' \
                and search.getAttribute('parent') != '':
            search.setAttribute("parent",
                                search_dict.get(search.getAttribute("parent"),
                                                'search'))
    try:
        fp = open(outputfile, "w")
        fp.write(dom.toxml())
    except Exception as err:
        print("error while saving output file: %s" % err)