def load_from_config(cp, model, **kwargs):
    """Loads a sampler from the given config file.

    This looks for a name in the section ``[sampler]`` to determine which
    sampler class to load. That sampler's ``from_config`` is then called.

    Parameters
    ----------
    cp : WorkflowConfigParser
        Config parser to read from.
    model : pycbc.inference.model
        Which model to pass to the sampler.
    \**kwargs :
        All other keyword arguments are passed directly to the sampler's
        ``from_config`` file.

    Returns
    -------
    sampler :
        The initialized sampler.
    """
    name = cp.get('sampler', 'name')
    return samplers[name].from_config(cp, model, **kwargs)