import importlib


def get_executor(config, model):
    """
    according the config['executor'] to create the executor

    Args:
        config(ConfigParser): config
        model(AbstractModel): model

    Returns:
        AbstractExecutor: the loaded executor
    """
    try:
        return getattr(importlib.import_module('libcity.executor'),
                       config['executor'])(config, model)
    except AttributeError:
        raise AttributeError('executor is not found')