def _check_same_ip_to_multiple_host(config):
 ips_to_hostnames_mapping = dict()
 for (key, value) in config.iteritems():
  if key.endswith('hosts'):
   for (_key, _value) in value.iteritems():
    hostname = _key
    ip = _value['ip']
    if (not (ip in ips_to_hostnames_mapping)):
     ips_to_hostnames_mapping[ip] = hostname
    elif (ips_to_hostnames_mapping[ip] != hostname):
     info = (ip, ips_to_hostnames_mapping[ip], hostname)
     raise MultipleHostsWithOneIPError(*info)
 logger.debug('No hosts with duplicated IPs found')

def _check_same_ip_to_multiple_host ( config ) : ips_to_hostnames_mapping = dict ( ) for ( key , value ) in config . iteritems ( ) : if key . endswith ( 'hosts' ) : for ( _key , _value ) in value . iteritems ( ) : hostname = _key ip = _value [ 'ip' ] if ( not ( ip in ips_to_hostnames_mapping ) ) : ips_to_hostnames_mapping [ ip ] = hostname elif ( ips_to_hostnames_mapping [ ip ] != hostname ) : info = ( ip , ips_to_hostnames_mapping [ ip ] , hostname ) raise MultipleHostsWithOneIPError ( * info ) logger . debug ( 'No hosts with duplicated IPs found' )
check for ips assigned to multiple hosts : param: config: dict user provided configuration .