Implemented ensuredir and removedir for Python and add unittests