def serve_rpc_request(request, url_name="root", **kwargs):
    '''
    This method handles rpc calls based on the content type of the request
    '''
    
    dispatcher = get_dispatcher(request.path, url_name)
    
    if request.method == "POST" and len(request.POST) > 0:
        # Handle POST request with RPC payload
        
        if LOG_REQUESTS_RESPONSES:
            logger.debug('\nIncoming request\n----------------')
            logger.debug('\n%s\n\n\n\n' % str(request.raw_post_data))
            
        if _is_xmlrpc_request(request):
            if RESTRICT_XML:
                raise Http404
            
            if not _check_request_permission(request, 'xml', url_name=url_name):
                return HttpResponseForbidden()
            
            resp = dispatcher.xmldispatch(request.raw_post_data,
                                          request=request, **kwargs)
            response_type = 'text/xml'
        else:
            if RESTRICT_JSON:
                raise Http404
            
            if not _check_request_permission(request, 'json',url_name=url_name):
                return HttpResponseForbidden()
            
            resp = dispatcher.jsondispatch(request.raw_post_data,
                                           request=request)
            response_type = 'application/json'
            
        if LOG_REQUESTS_RESPONSES:
            logger.debug('Outgoing %s request\n---------------------------' % response_type)
            logger.debug(resp % '\n%s\n\n\n\n')
        
        return HttpResponse(resp, response_type)
    elif request.method == 'OPTIONS':
        # Handle OPTIONS request for "preflighted" requests
        # see https://developer.mozilla.org/en/HTTP_access_control
        
        response = HttpResponse('', 'text/plain')
        
        origin = request.META.get('HTTP_ORIGIN', 'unknown origin')
        response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
        response['Access-Control-Max-Age'] = 0
        response['Access-Control-Allow-Credentials'] = \
                        str(HTTP_ACCESS_CREDENTIALS).lower()
        response['Access-Control-Allow-Origin']= HTTP_ACCESS_ALLOW_ORIGIN
        
        response['Access-Control-Allow-Headers'] = \
                    request.META.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS', '')
                    
        if LOG_REQUESTS_RESPONSES:
            logger.debug('Outgoing HTTP access response to: %s' %(origin))
                    
        return response
    else:
        # Handle GET request
        
        if RESTRICT_METHOD_SUMMARY:
            # hide the documentation by raising 404
            raise Http404
        
        # show documentation
        methods = dispatcher.list_methods()
        template_data = {
            'methods': methods,
            'url': request.path,
            
            # rpc4django version
            'version': version(),
            
            # restricts the ability to test the rpc server from the docs
            'restrict_rpctest': RESTRICT_RPCTEST,
        }
        return render_to_response('rpc4django/rpcmethod_summary.html', \
                                  template_data)

# exclude from the CSRF framework because RPC is intended to be used cross site
dataset/ETHPy150Open fp7-ofelia/ocf/vt_manager/src/python/vt_manager/common/rpc4django/views.py/serve_rpc_request/swapped operands of `%`