import importlib


def load_task_instance(name):
    """
    Create an instance of the provided task name.

    Note: this will not validate that the task is actually a task object. Be careful with this.
    You are required to validate that the task name is valid and this is not going to load some
    random class that you haven't expected.

    :param name: fully qualified name of the class to create an instance of.
    :return: an instance of the class requested or a exception in case of problems.
    """
    parts = name.split('.')
    class_name = parts[-1]
    package_name = '.'.join(parts[:-1])
    mod = importlib.import_module(name=package_name)
    clazz = getattr(mod, class_name)
    return clazz()