'A generator function to be used to delete all the segments and
sub-segments referenced in a manifest.
:params req: a swob.Request with an SLO manifest in path
:raises HTTPPreconditionFailed: on invalid UTF8 in request path
:raises HTTPBadRequest: on too many buffered sub segments and
on invalid SLO manifest path'

def get_segments_to_delete_iter(self, req):

    if (not check_utf8(req.path_info)):
        raise HTTPPreconditionFailed(request=req, body='Invalid    UTF8    or    contains    NULL')
    (vrs, account, container, obj) = req.split_path(4, 4, True)
    segments = [{'sub_slo': True, 'name': ('/%s/%s' % (container, obj)).decode('utf-8')}]
    while segments:
        if (len(segments) > MAX_BUFFERED_SLO_SEGMENTS):
            raise HTTPBadRequest('Too    many    buffered    slo    segments    to    delete.')
        seg_data = segments.pop(0)
        if seg_data.get('sub_slo'):
            try:
                segments.extend(self.get_slo_segments(seg_data['name'], req))
            except HTTPException as err:
                seg_data['error'] = {'code': err.status_int, 'message': err.body}
            seg_data['sub_slo'] = False
            segments.append(seg_data)
        else:
            seg_data['name'] = seg_data['name'].encode('utf-8')
            (yield seg_data)
