Redefining all blocks at once

Continuing the discussion from Method of defining material to blocks:

You can ask some of the guys that are good at scripting in Python or Rhinoscript. There should be an easy way to redefine all the blocks at once (or only the ones you want) changing the material to ‘by parent’. @clement ?

@guctony, See if that helps:
http://discourse.mcneel.com/t/r6-wishlist-manage-layers-within-blocks/22154/17?u=jarek

Thanks @Jarek !