import importlib


def import_class(path):
    """Import a class by its path

    Args:
        path (str): the path to the class, in similar notation as modules

    Returns:
        class: the specified class

    Examples:
        >>> import_class("reprobench.core.server.BenchmarkServer")
        <class 'reprobench.core.server.BenchmarkServer'>
    """
    module_path, tail = ".".join(path.split(".")[:-1]), path.split(".")[-1]
    module = importlib.import_module(module_path)
    return getattr(module, tail)