def get_name_and_placement(request, minsegs=1, maxsegs=None, rest_with_last=False):
 policy_index = request.headers.get('X-Backend-Storage-Policy-Index')
 policy = POLICIES.get_by_index(policy_index)
 if (not policy):
  raise HTTPServiceUnavailable(body=(_('No policy with index %s') % policy_index), request=request, content_type='text/plain')
 results = split_and_validate_path(request, minsegs=minsegs, maxsegs=maxsegs, rest_with_last=rest_with_last)
 results.append(policy)
 return results

def get_name_and_placement ( request , minsegs = 1 , maxsegs = None , rest_with_last = False ) : policy_index = request . headers . get ( 'X-Backend-Storage-Policy-Index' ) policy = POLICIES . get_by_index ( policy_index ) if ( not policy ) : raise HTTPServiceUnavailable ( body = ( _ ( 'No policy with index %s' ) % policy_index ) , request = request , content_type = 'text/plain' ) results = split_and_validate_path ( request , minsegs = minsegs , maxsegs = maxsegs , rest_with_last = rest_with_last ) results . append ( policy ) return results
utility function to split and validate the request path and storage policy .