def get_app(self, app=None):
        """Obtain a new (decorated) WSGI app to hook into the origin server."""
        if app is None:
            app = cherrypy.tree

        if self.validate:
            try:
                from wsgiref import validate
            except ImportError:
                warnings.warn(
                    'Error importing wsgiref. The validator will not run.',
                )
            else:
                # wraps the app in the validator
                app = validate.validator(app)

        return app
Obtain a new (decorated) WSGI app to hook into the origin server.
cherrypy/test/helper.py