

def get_relationship_info(tree, media, image_sizes):
    '\n    There is a separate file holds the targets to links as well as the targets\n    for images. Return a dictionary based on the relationship id and the\n    target.\n    '
    if (tree is None):
        return {
            
        }
    result = {
        
    }
    for el in tree.iter():
        el_id = el.get('Id')
        if (el_id is None):
            continue
        target = el.get('Target')
        if any((target.lower().endswith(ext) for ext in IMAGE_EXTENSIONS_TO_SKIP)):
            continue
        if (target in media):
            image_size = image_sizes.get(el_id)
            target = convert_image(media[target], image_size)
        result[el_id] = cgi.escape(target)
    return result

dataset/ETHPy150Open PolicyStat/docx2html/docx2html/core.py get_relationship_info/original