# Retrieving the Material from a NodeTree

For a driver scripted expression I want the name of the material for a node input value. It's an emission node and I want to make the following scripted expression for the emission strength:

bpy.data.lights[self.material.name].energy


'self' refers to the nodetree, but self.material isn't a valid expression obviously. There appears to be no way of referencing the targeted material from a nodetree according to the python API.

self.id_data just refers to itself, so I'm stumped. Surely there must be a way to find the material of a nodetree besides scanning every single material in the blend data for the nodetree reference?