function can now be convert into python code