def METHOD_NAME(dom, rootdirs):
    for img in dom.getElementsByTagName("img"):
        src = img.getAttribute("src")
        if not src.strip("\"'").startswith("data:") and len(src) > 0:
            imgfile = _resolve_path(img.getAttribute("src"), rootdirs)
            img.setAttribute(u"src", serve.make_base64(imgfile).replace('\n', ''))