def has_at_least_one_key(*keys):
    def validate(obj):
        """Test keys exist in dict."""
        if not isinstance(obj, dict):
            raise vol.Invalid('expected dictionary')

        for k in obj.keys():
            if k in keys:
                return obj
        raise vol.Invalid('must contain one of {}.'.format(', '.join(keys)))

    return validate
Validator that at least one key exists.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/helpers/config_validation.py/has_at_least_one_key