Fix python bindings to hold a reference to sessions