def build_profile_map(parsed_ini_config):
 parsed_config = copy.deepcopy(parsed_ini_config)
 profiles = {}
 final_config = {}
 for (key, values) in parsed_config.items():
  if key.startswith('profile'):
   try:
    parts = shlex.split(key)
   except ValueError:
    continue
   if (len(parts) == 2):
    profiles[parts[1]] = values
  elif (key == 'default'):
   profiles[key] = values
  else:
   final_config[key] = values
 final_config['profiles'] = profiles
 return final_config

def build_profile_map ( parsed_ini_config ) : parsed_config = copy . deepcopy ( parsed_ini_config ) profiles = { } final_config = { } for ( key , values ) in parsed_config . items ( ) : if key . startswith ( 'profile' ) : try : parts = shlex . split ( key ) except ValueError : continue if ( len ( parts ) == 2 ) : profiles [ parts [ 1 ] ] = values elif ( key == 'default' ) : profiles [ key ] = values else : final_config [ key ] = values final_config [ 'profiles' ] = profiles return final_config
convert the parsed ini config into a profile map .