Thank you for the suggestion! I will try it, and share my results. If it works well in python (apart from the performance)  maybe it will motivate me to seek a more efficient solution such as hacking away in C++.