'A version of pkgutil.walk_packages() that will restrict itself to
a given path.'

def _restricted_walk_packages(self, walk_packages, path=None):

    default_path = (path or [os.path.dirname(__file__)])
    def wrapper(path=None, prefix='', onerror=None):
        return walk_packages((path or default_path), prefix, onerror)
    return wrapper
