<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete(request, obj_id=None):
 """ Removes ImageVideo objects from Gallery """

    data = request.DELETE or json.loads(request.body)
    guids = data.get('guids').split(',')
    objects = getObjectsFromGuids(guids)
    gallery = Gallery.objects.get(pk=obj_id)

    LOGGER.info('{} removed {} from {}'.format(request.user.email, guids, gallery))

    for o in objects:
        if isinstance(o, Image):
            gallery.images.remove(o)
        elif isinstance(o, Video):
            gallery.videos.remove(o)

    res = Result()

    return JsonResponse(res.asDict())