Sorting Contours using Python and OpenCV