def __generateResponse(self,request,response,code=200):
        if isinstance(response, str):
            return Response(code,response,{HttpHeader.CONTENT_TYPE: MediaType.TEXT_PLAIN})
        elif isinstance(response, Response):
            return response
        else:
            (content,contentType) = self.__convertObjectToContentType(request, response)
            return Response(code,content,{HttpHeader.CONTENT_TYPE:contentType})
Takes care of automatically rendering the response and converting it to appropriate format (text,XML,JSON,YAML)
dataset/ETHPy150Open jacek99/corepost/corepost/routing.py/RequestRouter.__generateResponse