import importlib


def load_class_by_name(full_class_name):
    """Load a class by its fully-qualified name.

    "Fully qualified name" is a LoR-specific. It is PACKAGE.MODULE.CLASS_NAME. Examples:

    - lor.tasks.fs.EnsureExistsOnLocalFilesystemTask

    Raises an exception if `full_class_name` cannot be found.

    :param full_class_name: Fully-qualified name of a class as a string
    :return: A python class
    """
    module_name = ".".join(full_class_name.split(".")[0:-1])
    class_name = full_class_name.split(".")[-1]

    mod = importlib.import_module(module_name)
    return getattr(mod, class_name)