def create_method_callback(method_name, **kwargs):
    """Creates a callback function which executes model method.

    Args:
        method_name: The name (str) of the method to execute.
        kwargs: Optional keyword arguments.

    Returns:
        Callback to be used with run_model. For example, to call the 'test'
        method of a DaliModule:

        cb = create_method_callback('test')
    """
    def callback_method(model):
        return getattr(model, method_name)(**kwargs)
    return callback_method