Prettify python-markdown

- add function docstring
- use typeof for undefined testing