def _check_config(config):

    '''
    Checks the desired config and clears interesting details.
    '''

    if not _valid_dict(config):
        return True, ''

    _community = config.get('community')
    _community_tmp = {}
    if not _community:
        return False, 'Must specify at least a community.'
    if _valid_str(_community):
        _community_tmp[_community] = _community_defaults()
    elif isinstance(_community, list):
        # if the user specifies the communities as list
        for _comm in _community:
            if _valid_str(_comm):
                # list of values
                _community_tmp[_comm] = _community_defaults()
                # default mode is read-only
            if _valid_dict(_comm):
                # list of dicts
                for _comm_name, _comm_details in six.iteritems(_comm):
                    if _valid_str(_comm_name):
                        _community_tmp[_comm_name] = _clear_community_details(_comm_details)
    elif _valid_dict(_community):
        # directly as dict of communities
        # recommended way...
        for _comm_name, _comm_details in six.iteritems(_community):
            if _valid_str(_comm_name):
                _community_tmp[_comm_name] = _clear_community_details(_comm_details)
    else:
        return False, 'Please specify a community or a list of communities.'

    if not _valid_dict(_community_tmp):
        return False, 'Please specify at least a valid community!'

    config['community'] = _community_tmp

    for key in ['location', 'contact', 'chassis_id']:
        # not mandatory, but should be here only if valid
        _str_elem(config, key)

    return True, ''
Checks the desired config and clears interesting details.