C++ algorithm and Python scripts for nice Connected Components Labeling