Modifed from: http://gehrcke.de/2014/02/distributing-a-python-command-line-application/