UV Toolkit 2.0 for Blender 2.8 -3.0x

Working code is in the end.

this line

 if sum_edges > 0:

replace with

if sum_edges > 0: