def general_config_get(config, config_get_patterns, config_validation, kodi_set, default, **kwargs):
 results = []
 for line in config[::(-1)]:
  if (not line.strip()):
   continue
  if line.strip().startswith('#'):
   continue
  if ('#' in line):
   line = line[:line.index('#')]
  for pair in config_get_patterns:
   matched = re.search(pair['identify'], line, re.IGNORECASE)
   if matched:
    raw_value = re.search(pair['extract'], line, re.IGNORECASE)
    if raw_value:
     result = config_validation(raw_value.group(1))
     if (result is not None):
      results.append(result)
 kodi_setting = kodi_set(results)
 if (kodi_setting is None):
  kodi_setting = retrieve_default(**default)
 return kodi_setting

def general_config_get ( config , config_get_patterns , config_validation , kodi_set , default , ** kwargs ) : results = [ ] for line in config [ : : ( - 1 ) ] : if ( not line . strip ( ) ) : continue if line . strip ( ) . startswith ( '#' ) : continue if ( '#' in line ) : line = line [ : line . index ( '#' ) ] for pair in config_get_patterns : matched = re . search ( pair [ 'identify' ] , line , re . IGNORECASE ) if matched : raw_value = re . search ( pair [ 'extract' ] , line , re . IGNORECASE ) if raw_value : result = config_validation ( raw_value . group ( 1 ) ) if ( result is not None ) : results . append ( result ) kodi_setting = kodi_set ( results ) if ( kodi_setting is None ) : kodi_setting = retrieve_default ( ** default ) return kodi_setting
searches the config .