def validate(config):
    '''
    Validate the beacon configuration
    '''

    VALID_ITEMS = [
        'type', 'bytes_sent', 'bytes_recv', 'packets_sent',
        'packets_recv', 'errin', 'errout', 'dropin',
        'dropout'
    ]

    # Configuration for load beacon should be a list of dicts
    if not isinstance(config, dict):
        return False, ('Configuration for load beacon must be a dictionary.')
    else:
        for item in config:
            if not isinstance(config[item], dict):
                return False, ('Configuration for load beacon must '
                               'be a dictionary of dictionaries.')
            else:
                if not any(j in VALID_ITEMS for j in config[item]):
                    return False, ('Invalid configuration item in '
                                   'Beacon configuration.')
    return True, 'Valid beacon configuration'
dataset/ETHPy150Open saltstack/salt/salt/beacons/network_info.py/validate/original