def _check_config(config):
 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):
  for _comm in _community:
   if _valid_str(_comm):
    _community_tmp[_comm] = _community_defaults()
   if _valid_dict(_comm):
    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):
  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']:
  _str_elem(config, key)
 return (True, '')

def _check_config ( config ) : 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 ) : for _comm in _community : if _valid_str ( _comm ) : _community_tmp [ _comm ] = _community_defaults ( ) if _valid_dict ( _comm ) : 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 ) : 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' ] : _str_elem ( config , key ) return ( True , '' )
checks the desired config and clears interesting details .