def _setup(self):
        """Wire this tool into ``cherrypy.request``.

        The standard CherryPy request object will automatically call
        this method when the tool is "turned on" in config.
        """
        hooks = cherrypy.serving.request.hooks

        conf = self._merged_args()

        p = conf.pop('priority', None)
        if p is None:
            p = getattr(self.callable, 'priority', self._priority)

        hooks.attach(self._point, self.callable, priority=p, **conf)

        locking = conf.pop('locking', 'implicit')
        if locking == 'implicit':
            hooks.attach('before_handler', self._lock_session)
        elif locking == 'early':
            # Lock before the request body (but after _sessions.init runs!)
            hooks.attach(
                'before_request_body',
                self._lock_session,
                priority=60,
            )
        else:
            # Don't lock
            pass

        hooks.attach('before_finalize', _sessions.save)
        hooks.attach('on_end_request', _sessions.close)
Wire this tool into ``cherrypy.request``.

        The standard CherryPy request object will automatically call
        this method when the tool is "turned on" in config.
        
cherrypy/_cptools.py