Beginning update of depcheck

Rewriting the depcheck script so that it can be run standalone, or used by
another internal tool. Some of it is rewritten, but work is ongoing.