code: def use(self, func, when='whenever'):
          ''' Append a middleware to the algorithm '''
          #NOTE A middleware Object ?
          # self.use() is usually called from initialize(), so no logger yet
          print('registering middleware {}'.format(func.__name__))
          self.middlewares.append({
              'call': func,
              'name': func.__name__,
              'args': func.func_code.co_varnames,
              'when': when
          }f use(self, func, when='whenever'):
          ''' Append a middleware to the algorithm '''
          #NOTE A middleware Object ?
          # self.use() is usually called from initialize(), so no logger yet
          print('registering middleware {}'.format(func.__name__))
          self.middlewares.append({
              'call': func,
              'name': func.__name__,
              'args': func.func_code.co_varnames,
              'when': when
          })
docs: Append a middleware to the algorithm