elif ('whens' in self.opts['grains'] and
                      i in self.opts['grains']['whens']):
                    if not isinstance(self.opts['grains']['whens'],
                                      dict):
                        data['_error'] = ('Grain "whens" must be a dict. '