Change links format in python in markdown files

I need to replace in markdown file any occurrence of links of kind #something to /slugify(something). Slugify is a library for making names as slug.

Eg. [this is a reference](#my%20own%20reference!!) to [this is a reference](/my-own-reference).

Note that %20 is substitute to blank before apply slugify (because slugify.slugify('my%20own%20reference!!') gets 'my-20own-20reference')