def filter_settings_spec(settings_spec, *exclude, **replace):
 settings = list(settings_spec)
 for i in range(2, len(settings), 3):
  newopts = []
  for opt_spec in settings[i]:
   opt_name = [opt_string[2:].replace('-', '_') for opt_string in opt_spec[1] if opt_string.startswith('--')][0]
   if (opt_name in exclude):
    continue
   if (opt_name in replace.keys()):
    newopts.append(replace[opt_name])
   else:
    newopts.append(opt_spec)
  settings[i] = tuple(newopts)
 return tuple(settings)

def filter_settings_spec ( settings_spec , * exclude , ** replace ) : settings = list ( settings_spec ) for i in range ( 2 , len ( settings ) , 3 ) : newopts = [ ] for opt_spec in settings [ i ] : opt_name = [ opt_string [ 2 : ] . replace ( '-' , '_' ) for opt_string in opt_spec [ 1 ] if opt_string . startswith ( '--' ) ] [ 0 ] if ( opt_name in exclude ) : continue if ( opt_name in replace . keys ( ) ) : newopts . append ( replace [ opt_name ] ) else : newopts . append ( opt_spec ) settings [ i ] = tuple ( newopts ) return tuple ( settings )
return a copy of settings_spec excluding/replacing some settings .