import importlib


def create_class(classname: str, module_name: str) -> type:
    """ Given the classname and module, creates a class object and returns it

    Parameters
    ----------
    classname : str
        Class name to import
    module_name : str
        The module in which the class is present

    Returns
    -------
    type

    """
    try:
        module = importlib.import_module(module_name)
        try:
            cls = getattr(module, classname)
            return cls
        except AttributeError:
            raise AttributeError(
                f"class {classname} is not found in module {module_name}"
            )
    except ModuleNotFoundError:
        raise ModuleNotFoundError(f"Module {module_name} is not found")