Export material from Cycles for Cycles? I saw this question and learned it's very tricky to export material from Cycles for other applications' use. So let me clarify: I only work with Blender. 



Previously while I was working with BI, I can export a plane as a .obj file specifying the geometry and an accompanying .mtl specifying the material, such as specular and diffuse colors, etc. If I import this .obj file back to BI, I get every setting back.

Now I switch to Cycles. I create a glossy material for my cube and export it as usual. Now if I re-import this .obj file back to Cycles, my material settings are all gone.

Before exporting



After re-importing



What is the proper way of exporting a Cycles material?

P.S.: It would be wonderful if the answer could be given from the Python API perspective. :-)
Save your materials into a normal blend file.

A blend file is a database and you can use only selected parts (data-blocks) from it. This is done using linking and appending. See this: What is the differance between Linking and Appending an external blend?

This is also possible in python: How to Link/Append a data-block using the Python API?