def split_and_validate_path(request, minsegs=1, maxsegs=None, rest_with_last=False):
 try:
  segs = split_path(unquote(request.path), minsegs, maxsegs, rest_with_last)
  validate_device_partition(segs[0], segs[1])
  return segs
 except ValueError as err:
  raise HTTPBadRequest(body=str(err), request=request, content_type='text/plain')

def split_and_validate_path ( request , minsegs = 1 , maxsegs = None , rest_with_last = False ) : try : segs = split_path ( unquote ( request . path ) , minsegs , maxsegs , rest_with_last ) validate_device_partition ( segs [ 0 ] , segs [ 1 ] ) return segs except ValueError as err : raise HTTPBadRequest ( body = str ( err ) , request = request , content_type = 'text/plain' )
utility function to split and validate the request path .