@classmethod
def from_kwargs(cls, **kwargs):
    """Initialise configuration from kwargs."""
    config = cls()
    for slot in cls.__slots__:
        if slot.startswith('_'):
            slot = slot[1:]
        setattr(config, slot, kwargs.pop(slot, cls.get_default(slot)))
    if kwargs:
        raise ValueError('Unrecognized option(s): {}'.format(kwargs.keys()))
    return config
