Script for making every material one material per one object

Hello,

I need some help with making a python script.
Anybody know how to automatically duplicate any material that’s linked to multiple objects
so that there is one material for every object?

For example,

121412

Here you see Material231 linked to two objects; Cone and Cube. I would like to develope a script which duplicates/makes a new material based on Material231 and automatically links it to other objects.

Any help is appreciated.

Thank you!

Read Make Materials Single-User via code?