minimize session state held python-side