def split_arg_string(string):
 rv = []
 for match in re.finditer('(\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\\S+)\\s*', string, re.S):
  arg = match.group().strip()
  if ((arg[:1] == arg[(-1):]) and (arg[:1] in '"\'')):
   arg = arg[1:(-1)].encode('ascii', 'backslashreplace').decode('unicode-escape')
  try:
   arg = type(string)(arg)
  except UnicodeError:
   pass
  rv.append(arg)
 return rv

def split_arg_string ( string ) : rv = [ ] for match in re . finditer ( '(\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\\S+)\\s*' , string , re . S ) : arg = match . group ( ) . strip ( ) if ( ( arg [ : 1 ] == arg [ ( - 1 ) : ] ) and ( arg [ : 1 ] in '"\'' ) ) : arg = arg [ 1 : ( - 1 ) ] . encode ( 'ascii' , 'backslashreplace' ) . decode ( 'unicode-escape' ) try : arg = type ( string ) ( arg ) except UnicodeError : pass rv . append ( arg ) return rv
given an argument string this attempts to split it into small parts .