a python qps context manager wrapper