from importlib import import_module


def dynamic_import(attribute, module_path):
    """Import attribute from module found at module_path at runtime.

    Args:
        attribute: the attribute of the module to import (class, function, ...)
        module_path: the path to the module.

    Returns:
        attribute from module_path.

    """

    mod = import_module(module_path)
    return getattr(mod, attribute)