We don't want calling code to run into trouble because of that. Fixes #2506
Also improved get_class by using importlib instead of complicated climbing through the whole module tree.