'Implement the processing stack.'

def _process_stack(self, request, action, action_args, content_type, body, accept):

    try:
        (meth, extensions) = self.get_method(request, action, content_type, body)
    except (AttributeError, TypeError):
        return Fault(webob.exc.HTTPNotFound())
    except KeyError as ex:
        msg = (_('There    is    no    such    action:    %s') % ex.args[0])
        return Fault(webob.exc.HTTPBadRequest(explanation=msg))
    except exception.MalformedRequestBody:
        msg = _('Malformed    request    body')
        return Fault(webob.exc.HTTPBadRequest(explanation=msg))
    if body:
        msg = (_("Action:    '%(action)s',    calling    method:    %(meth)s,    body:    %(body)s") % {'action': action, 'body': six.text_type(body, 'utf-8'), 'meth': str(meth)})
        LOG.debug(strutils.mask_password(msg))
    else:
        LOG.debug("Calling    method    '%(meth)s'", {'meth': str(meth)})
    try:
        contents = self._get_request_content(body, request)
    except exception.MalformedRequestBody:
        msg = _('Malformed    request    body')
        return Fault(webob.exc.HTTPBadRequest(explanation=msg))
    action_args.update(contents)
    project_id = action_args.pop('project_id', None)
    context = request.environ.get('nova.context')
    if (context and project_id and (project_id != context.project_id)):
        msg = (_("Malformed    request    URL:    URL's    project_id    '%(project_id)s'    doesn't    match    Context's    project_id    '%(context_project_id)s'") % {'project_id': project_id, 'context_project_id': context.project_id})
        return Fault(webob.exc.HTTPBadRequest(explanation=msg))
    response = None
    try:
        with ResourceExceptionHandler():
            action_result = self.dispatch(meth, request, action_args)
    except Fault as ex:
        response = ex
    if (not response):
        resp_obj = None
        if ((type(action_result) is dict) or (action_result is None)):
            resp_obj = ResponseObject(action_result)
        elif isinstance(action_result, ResponseObject):
            resp_obj = action_result
        else:
            response = action_result
        if resp_obj:
            if hasattr(meth, 'wsgi_code'):
                resp_obj._default_code = meth.wsgi_code
            response = self.process_extensions(extensions, resp_obj, request, action_args)
        if (resp_obj and (not response)):
            response = resp_obj.serialize(request, accept)
    if hasattr(response, 'headers'):
        for (hdr, val) in list(response.headers.items()):
            if six.PY2:
                response.headers[hdr] = utils.utf8(val)
            else:
                response.headers[hdr] = encodeutils.safe_decode(utils.utf8(val))
        if (not request.api_version_request.is_null()):
            response.headers[API_VERSION_REQUEST_HEADER] = ('compute    ' + request.api_version_request.get_string())
            response.headers[LEGACY_API_VERSION_REQUEST_HEADER] = request.api_version_request.get_string()
            response.headers.add('Vary', API_VERSION_REQUEST_HEADER)
            response.headers.add('Vary', LEGACY_API_VERSION_REQUEST_HEADER)
    return response
