self.map[var].color = color
for key in node.neighbors:
    if color in self.domains[key]:
        self.domains[key].remove(color)
Recursion: how to avoid Python set changed set during iteration RuntimeError