Old code assumes that a NodeParam's parent will always be a Node. The function has been separated off and tweaked in the event that this is not the case.