Refactor, remove duplication and add base test.
Imports & pep8.
Add type and path mapper.
Add unicode aware encapsulator.
Update documentation.