Problems asigning undefined Value in python

So here is the thing. I am trying to set up a value of undefined,

Just a simple test with materials.

I run the following code


import MaxPlus
selection = MaxPlus.SelectionManager.Nodes
for i in selection:
    g = i.Material
    print g

if the object has a material will print

Animatable(VRayMtl)

if the object doesn´t have a material will print None

but if I try to run the following code (when the object has a material).
I will run in the following error

import MaxPlus

selection = MaxPlus.SelectionManager.Nodes
for i in selection:
    i.Material = None 

>> MAXScript MacroScript Error Exception:
– Runtime error: Line 6487 SetMaterial()
<type ‘exceptions.ValueError’> invalid null reference in method ‘INode_SetMaterial’, argument 2 of type ‘Autodesk::Max::Mtl’ <<

So the question is how come the value of the material is None when it doesn’t have the material assigned, but if i try to assign this value directly I get an error. what am I missing? any help here will be appreciated.