def check_extra_vars(module_vars, spec):
    """Raise when unexpected information is defined to avoid errors."""
    kind = spec.__name__.lower().strip('info')
    extra_vars = set(module_vars) - set(spec().trait_names())
    if extra_vars:
        msg = (
            'The following variables were unexpectedly present in the {} information module: {}'
            .format(kind, ', '.join(extra_vars)))
        raise RuntimeError(msg)
