Assign VRay Material to Rhino Solid in Python Script

Is there any way one could assign an existing or new VRay material to a selected Rhino object in code using Python.

Have looked around but couldn’t find any examples.

Pointers to any example code would be highly appreciated.

V-Ray materials are just regular Rhino render materials, just having handful of extra parameters.
You assign them as usually you assign a render material.
Something along those lines

import Rhino

doc = Rhino.RhinoDoc.ActiveDoc
material = doc.RenderMaterials[0]#take the first material

#assign to every object in the selection
for obj in doc.Objects.GetSelectedObjects(True, True):
    obj.RenderMaterial = material
    obj.CommitChanges();