docs: def turnstile_filter(global_conf, **local_conf):
      """
      Factory function for turnstile.
  
      Returns a function which, when passed the application, returns an
      instance of the TurnstileMiddleware.
      """
  
      # Select the appropriate middleware class to return
      klass = TurnstileMiddleware
      if 'turnstile' in local_conf:
          klass = utils.find_entrypoint('turnstile.middleware',
                                        local_conf['turnstile'], required=True)
  
      def wrapper(app):
          return klass(app, local_conf)
  
      return wrapper