def validate_exempted_device_types(conn, config):
    'Method to validate exempted device types specified in config.'
    with conn.cursor() as cursor:
        logger = logging.getLogger('dirbs.config')
        exempted_device_types = config.region_config.exempted_device_types
        if (len(exempted_device_types) > 0):
            cursor.execute('SELECT DISTINCT device_type FROM gsma_data')
            all_device_types = [x.device_type for x in cursor]
            if (len(all_device_types) == 0):
                logger.warning('RegionConfig: Ignoring setting exempted_device_types={0} as GSMA TAC database not imported or no device types found.'.format(exempted_device_types))
            else:
                invalid_device_types = (set(exempted_device_types) - set(all_device_types))
                if (len(invalid_device_types) > 0):
                    msg = "RegionConfig: exempted_device_types '{0}' is/are not valid device type(s). The valid GSMA device types are: '{1}'".format(invalid_device_types, all_device_types)
                    logger.error(msg)
                    raise ConfigParseException(msg)
Method to validate exempted device types specified in config.
def validate_exempted_device_types(conn, config):
    
    with conn.cursor() as cursor:
        logger = logging.getLogger('dirbs.config')
        exempted_device_types = config.region_config.exempted_device_types
        if (len(exempted_device_types) > 0):
            cursor.execute('SELECT DISTINCT device_type FROM gsma_data')
            all_device_types = [x.device_type for x in cursor]
            if (len(all_device_types) == 0):
                logger.warning('RegionConfig: Ignoring setting exempted_device_types={0} as GSMA TAC database not imported or no device types found.'.format(exempted_device_types))
            else:
                invalid_device_types = (set(exempted_device_types) - set(all_device_types))
                if (len(invalid_device_types) > 0):
                    msg = "RegionConfig: exempted_device_types '{0}' is/are not valid device type(s). The valid GSMA device types are: '{1}'".format(invalid_device_types, all_device_types)
                    logger.error(msg)
                    raise ConfigParseException(msg)