def handle_media_edits(request, item, should_edit, resp, lang):
    if 'corrections' not in resp:
        resp['corrections'] = {}
    for attribute in ('media_image', 'media_audio'):
        if should_edit(attribute):
            media_path = process_media_attribute(attribute, resp, request.POST.get(attribute))
            item._set_media(attribute, lang, media_path)
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/app_manager/views/media_utils.py/handle_media_edits/original