import importlib


def class_from_name(module_name: str, class_name: str):
    """
    Given a module name and class name, return a class.
    :param module_name: Module name to import.
    :param class_name: Class name to find in the module.
    :return: The class object.
    """
    try:
        return getattr(importlib.import_module(
            'home.iot.' + module_name),
            class_name
        )
    except ImportError as e:
        print(f"No such module exists: {module_name}.{class_name}")
        raise e