Script to store object's entire material setup and reuse them later?
what you need to do is to press the little "F" next to your material that you want to save for later.

This will save the material data block even though it is not assigned to any object. Then you can assign a new material to your object to experiment, and then come back later.

you can also set those by scripting

material.use_fake_user




If you want to swap materials back later via script, 
you could probably store your original material in the object datablock.
If you have multiple materials, it would be a bit more complicated, but you could remember which material slot held which original material.

Checkout how to work with blender datablocks to save custom metadata:

Datablock Documentation

This is how easily you could add your custom metadata to any object:

C.selected_objects[0]['OriginalMaterial'] = "materialName"
# Access it directly in the console
C.selected_objects[0]['OriginalMaterial']
'material'