def split_user_input(line, pattern=None):
 encoding = get_stream_enc(sys.stdin, 'utf-8')
 line = py3compat.cast_unicode(line, encoding)
 if (pattern is None):
  pattern = line_split
 match = pattern.match(line)
 if (not match):
  try:
   (ifun, the_rest) = line.split(None, 1)
  except ValueError:
   (ifun, the_rest) = (line, u'')
  pre = re.match('^(\\s*)(.*)', line).groups()[0]
  esc = ''
 else:
  (pre, esc, ifun, the_rest) = match.groups()
 return (pre, (esc or ''), ifun.strip(), the_rest.lstrip())

def split_user_input ( line , pattern = None ) : encoding = get_stream_enc ( sys . stdin , 'utf-8' ) line = py3compat . cast_unicode ( line , encoding ) if ( pattern is None ) : pattern = line_split match = pattern . match ( line ) if ( not match ) : try : ( ifun , the_rest ) = line . split ( None , 1 ) except ValueError : ( ifun , the_rest ) = ( line , u'' ) pre = re . match ( '^(\\s*)(.*)' , line ) . groups ( ) [ 0 ] esc = '' else : ( pre , esc , ifun , the_rest ) = match . groups ( ) return ( pre , ( esc or '' ) , ifun . strip ( ) , the_rest . lstrip ( ) )
split user input into initial whitespace .