factor out scan_module, invoke, ignore logic

As per issue #37, introduce a factored out scan_module and invoke. This change has two purposes:

* make ``scan_module`` available. I need the ability to scan a package without scanning any of its sub-modules or sub-packages, just its ``__init__.py``.

* refactor the rather large, nested scan() function. I think it's more readable as a result. I also factored out the ignore functionality into a top level helper function.