

def request(self, next, request):
    if (not request.args.get(self.get_param_name)):
        return next()
    sort_param = request.args.get(self.sort_param_name, 'time')
    if (sort_param not in _sort_keys):
        raise KeyError(('%s is not a supported sort_key. choose from: %r' % (sort_param, _sort_keys)))
    profiler = cProfile.Profile()
    try:
        ret = profiler.runcall(next)
    except:
        if self.raise_exc:
            raise
    buff = StringIO()
    stats = Stats(profiler, stream=buff).sort_stats(sort_param).print_stats()
    body = (_prof_tmpl % next.getvalue())
    ret.set_data(body)
    return ret

dataset/ETHPy150Open mahmoud/clastic/clastic/middleware/profile.py SimpleProfileMiddleware.request/VarMisuse@145/205 `buff`->`next`