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