Change project structure and add tests

This patch changes the project structure to use more pythonic module
and package names as well as provides a test case for the entity_count
function.