import importlib


def str_to_type(classpath):
    """
    convert class path in str format to a type
    :param classpath: class path
    :return: type
    """
    module_name, class_name = classpath.rsplit(".", 1)
    cls = getattr(importlib.import_module(module_name), class_name)
    return cls