def METHOD_NAME(filepath, encoding):
    # robot will usually write relative path to source of
    # keyword/library but we want it to be absolute
    from xml.etree import ElementTree
    from os.path import isabs, dirname, normpath, join
    tree = ElementTree.parse(filepath)
    root = tree.getroot()
    all_with_source = [root]
    all_with_source.extend(root.findall('kw'))
    dir_path = dirname(filepath)
    for tag in all_with_source:
        if tag.get('source') is not None and not isabs(tag.get('source')):
            abs_path = normpath(join(dir_path, tag.get('source')))
            tag.set('source', abs_path)
    return '<?xml version="1.0" encoding="UTF-8"?>\n' + ElementTree.tostring(root, encoding)