How ?
i can only this manually , i see no messages in the debug info that could help me
Though I have not written a single script for 2.79, I started by the 2.8 series to look into things.
I was able to get the same ideas from 2.8 back to 2.79, only the API changes but the ideas of accessing data were identical.
import bpy
material = bpy.data.materials['MY_MATERIAL']
node = material.node_tree.nodes['Material']
node.material = bpy.data.materials['zzz']