I'm looking for a library that let's configure/write special python block, something like ruby block and/or C-macros.
Looks like you're looking for metapython.