Refactored pySlice.py so that it can work as a module

It can now be run either directly as a python script, or it can now be
run as a Python module, and use the function inside it :D