def _parse_params(term):
 keys = ['key', 'type', 'section', 'file', 're', 'default']
 params = {}
 for k in keys:
  params[k] = ''
 thiskey = 'key'
 for (idp, phrase) in enumerate(term.split()):
  for k in keys:
   if (('%s=' % k) in phrase):
    thiskey = k
  if ((idp == 0) or (not params[thiskey])):
   params[thiskey] = phrase
  else:
   params[thiskey] += (' ' + phrase)
 rparams = [params[x] for x in keys if params[x]]
 return rparams

def _parse_params ( term ) : keys = [ 'key' , 'type' , 'section' , 'file' , 're' , 'default' ] params = { } for k in keys : params [ k ] = '' thiskey = 'key' for ( idp , phrase ) in enumerate ( term . split ( ) ) : for k in keys : if ( ( '%s=' % k ) in phrase ) : thiskey = k if ( ( idp == 0 ) or ( not params [ thiskey ] ) ) : params [ thiskey ] = phrase else : params [ thiskey ] += ( ' ' + phrase ) rparams = [ params [ x ] for x in keys if params [ x ] ] return rparams
safely split parameter term to preserve spaces .