Do not depend on the third_party module for the nongui code

This presents a problem when packaging python-safe for distribution in PyPi.

Ran all tests and they pass in OSX after the change. I also added checks in the Makefile to avoid similar problems in the future.