Load all modules automatically and find bases and eggs.

        :param module_paths: List of paths that should be discovered
        :param subclass: Optional Container subclass that should be used

def autodiscover(cls,
                     module_paths: List[str],
                     subclass: 'Container' = None) -> None:
        """
        Load all modules automatically and find bases and eggs.

        :param module_paths: List of paths that should be discovered
        :param subclass: Optional Container subclass that should be used
        """

        def find_base(bases: set, implementation: Type):
            found = {b for b in bases if issubclass(implementation, b)}
            if not found:
                raise ConfigurationError(
                    "No base defined for %r" % implementation)
            elif len(found) > 1:
                raise ConfigurationError(
                    "More than one base found for %r" % implementation)
            else:
                return found.pop()

        def walk(pkg: Union[str, ModuleType]) -> Dict[str, ModuleType]:
            if isinstance(pkg, str):
                pkg: ModuleType = importlib.import_module(pkg)
            results = {}

            try:
                path = pkg.__path__
            except AttributeError:
                results[pkg.__name__] = importlib.import_module(pkg.__name__)
            else:
                for loader, name, is_pkg in pkgutil.walk_packages(path):
                    full_name = pkg.__name__ + '.' + name
                    results[full_name] = importlib.import_module(full_name)
                    if is_pkg:
                        results.update(walk(full_name))
            return results

        with cls._lock:
            for module_path in module_paths:
                walk(module_path)

            config: List[Egg] = []
            for egg_ in egg.factories:
                base_ = find_base(base.classes, egg_.type_)
                egg_.base_ = base_
                config.append(egg_)

            cls.configure(config, subclass=subclass)