def split(line):
 if (not line.strip()):
  raise exceptions.MpdNoCommand(u'No command given')
 match = WORD_RE.match(line)
 if (not match):
  raise exceptions.MpdUnknownError(u'Invalid word character')
 (whitespace, command, remainder) = match.groups()
 if whitespace:
  raise exceptions.MpdUnknownError(u'Letter expected')
 result = [command]
 while remainder:
  match = PARAM_RE.match(remainder)
  if (not match):
   msg = _determine_error_message(remainder)
   raise exceptions.MpdArgError(msg, command=command)
  (unquoted, quoted, remainder) = match.groups()
  result.append((unquoted or UNESCAPE_RE.sub(u'\\g<1>', quoted)))
 return result

def split ( line ) : if ( not line . strip ( ) ) : raise exceptions . MpdNoCommand ( u'No command given' ) match = WORD_RE . match ( line ) if ( not match ) : raise exceptions . MpdUnknownError ( u'Invalid word character' ) ( whitespace , command , remainder ) = match . groups ( ) if whitespace : raise exceptions . MpdUnknownError ( u'Letter expected' ) result = [ command ] while remainder : match = PARAM_RE . match ( remainder ) if ( not match ) : msg = _determine_error_message ( remainder ) raise exceptions . MpdArgError ( msg , command = command ) ( unquoted , quoted , remainder ) = match . groups ( ) result . append ( ( unquoted or UNESCAPE_RE . sub ( u'\\g<1>' , quoted ) ) ) return result
split the source string by the occurrences of the pattern .