Contour Detection Python Code Using Functions To Solve