<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def serialize_image(ctx, document, elem, root):
 """Serialize image element. This is not abstract enough. """


    _img = etree.SubElement(root, 'img')
    # make path configurable

    if elem.rid in document.relationships[ctx.options['relationship']]:
        img_src = document.relationships[ctx.options['relationship']][elem.rid].get('target', '')
        img_name, img_extension = os.path.splitext(img_src)

        _img.set('src', 'static/{}{}'.format(elem.rid, img_extension))

    fire_hooks(ctx, document, elem, _img, ctx.get_hook('img'))

    return root