obj = Blender.Object.Get('NameOfObject')
if obj.getType() == 'Mesh':
msh = obj.getData(False)
mat = Blender.Material.Get('NameOfMaterial') #or create new and tweaks settings
msh.addMaterial(mat)
I’m in a hurry, so maybe some calls are misspelled, but the general sense is clear and you can always refer to the API doc.
Hope this helps
Bye