def validate_notification(notification, valid_events):
    """
    Validate a notification
    """
    for item in notification:
        if item not in ('event', 'type'):
            return (False, 'invalid item "%s" in notifications' % item)
        if item == 'event':
            if notification[item] not in valid_events:
                return (False, 'invalid notification event "%s"' % notification[item])
        if item == 'type':
            if notification[item] != 'email':
                return (False, 'invalid notification type "%s"' % notification[item])

    return (True, '')