def __split_quoted(s):
 if (len(s) == 0):
  return ('', '')
 q = quoted = s[0]
 rest = s[1:]
 while True:
  next_q = rest.find(q)
  if (next_q == (-1)):
   raise ValueError(("can't find ending quote '%s' in '%s'" % (q, s)))
  is_escaped = False
  i = (next_q - 1)
  while ((i >= 0) and (rest[i] == '\\')):
   i -= 1
   is_escaped = (not is_escaped)
  quoted += rest[0:(next_q + 1)]
  rest = rest[(next_q + 1):]
  if (not is_escaped):
   return (quoted, rest.lstrip())

def __split_quoted ( s ) : if ( len ( s ) == 0 ) : return ( '' , '' ) q = quoted = s [ 0 ] rest = s [ 1 : ] while True : next_q = rest . find ( q ) if ( next_q == ( - 1 ) ) : raise ValueError ( ( "can't find ending quote '%s' in '%s'" % ( q , s ) ) ) is_escaped = False i = ( next_q - 1 ) while ( ( i >= 0 ) and ( rest [ i ] == '\\' ) ) : i -= 1 is_escaped = ( not is_escaped ) quoted += rest [ 0 : ( next_q + 1 ) ] rest = rest [ ( next_q + 1 ) : ] if ( not is_escaped ) : return ( quoted , rest . lstrip ( ) )
looks for the ending quote character in the string that starts with quote character .