'Removes a membership from the image.'

@utils.mutating
def delete(self, req, image_id, id):

    self._check_can_access_image_members(req.context)
    try:
        image = self.db_api.image_get(req.context, image_id, v1_mode=True)
    except exception.NotFound:
        msg = (_('Image    %(id)s    not    found') % {'id': image_id})
        LOG.warn(msg)
        raise webob.exc.HTTPNotFound(msg)
    except exception.Forbidden:
        msg = (_LW("Access    denied    to    image    %(id)s    but    returning    'not    found'") % {'id': image_id})
        LOG.warn(msg)
        raise webob.exc.HTTPNotFound()
    if (not self.is_image_sharable(req.context, image)):
        msg = (_LW('User    lacks    permission    to    share    image    %(id)s') % {'id': image_id})
        LOG.warn(msg)
        msg = _('No    permission    to    share    that    image')
        raise webob.exc.HTTPForbidden(msg)
    members = self.db_api.image_member_find(req.context, image_id=image_id, member=id)
    if members:
        self.db_api.image_member_delete(req.context, members[0]['id'])
    else:
        LOG.debug('%(id)s    is    not    a    member    of    image    %(image_id)s', {'id': id, 'image_id': image_id})
        msg = _('Membership    could    not    be    found.')
        raise webob.exc.HTTPNotFound(explanation=msg)
    LOG.info(_LI('Successfully    deleted    a    membership    from    image    %(id)s'), {'id': image_id})
    return webob.exc.HTTPNoContent()
