def _parse_search_term(s):
 s = s.strip()
 split = s.split(maxsplit=1)
 if (len(split) == 2):
  engine = split[0]
  try:
   config.get('searchengines', engine)
  except configexc.NoOptionError:
   engine = None
   term = s
  else:
   term = split[1]
 elif (not split):
  raise ValueError('Empty search term!')
 else:
  engine = None
  term = s
 log.url.debug('engine {}, term {!r}'.format(engine, term))
 return (engine, term)

def _parse_search_term ( s ) : s = s . strip ( ) split = s . split ( maxsplit = 1 ) if ( len ( split ) == 2 ) : engine = split [ 0 ] try : config . get ( 'searchengines' , engine ) except configexc . NoOptionError : engine = None term = s else : term = split [ 1 ] elif ( not split ) : raise ValueError ( 'Empty search term!' ) else : engine = None term = s log . url . debug ( 'engine {}, term {!r}' . format ( engine , term ) ) return ( engine , term )
get a search engine name and search term from a string .