The code below finds a contour based on its maximum area but when there is no contour to be found I solve the ValueError by inputting default = None
ValueError
default = None