Changing the material of an object via python.

I have a simple object and 2 materials. A glossy blue and a rough red. As default the object’s material is set to the blue one but I want to change it to red after pressing a button.

How can I do that?

NO I don’t need logic bricks. I want to use as few as possible. Preferably only for calling the script but I have already done that. I just need the material change part.

bump .

This is about the game engine, right?

yes .