Error: IOError: symlink: operation not permitted (EPERM)

You probably want to iterate over either the keys or values of generators, not the pairs. You don’t have pairs as keys in P_G.