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