Improved Python snippets

* DocString for functions
* Unit test class and test function