Added unit tests and refactored scripts

This PR is mainly a refactored of the scripts file. I move almost all functions of `scripts/smart_dispatch.py` into either `smartdispatch/smartdispatch.py` or `smartdispatch/utils.py`. This PR also unit tests for those functions.

I don't think this PR is ready yet as it still misses some integration tests! If we were to accept it as is, we should add an issue about creating integration tests. What I mean by integration tests is testing the layout of the folders created by `scripts/smart_dispatch.py` and making sure `scripts/smart_worker.py` are doing the right thing!