Add flush method to python interface