BTW, you shouldn't test `len` like this.  Use `if not isyms` instead to test for empty set.