<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def line2argv(line):
 r"""Parse the given line into an argument vector. "line" is the line of input to parse. This may get niggly when dealing with quoting and escaping. The current state of this parsing may not be completely thorough/correct in this respect. ['foo'] ['foo', 'bar'] ['foo', 'bar'] ['foo', 'bar'] Quote handling: ['foo bar'] ['foo bar'] ['foo"bar'] ['foo bar', 'spam'] ['foo bar', 'spam'] ['some', 'simple', 'tests'] ['a', 'more complex', 'test'] ['a', 'more=complex test of ', 'quotes'] ['a', 'more complex test of ', 'quotes'] ['an', 'embedded "quote"'] # Komodo bug 48027 ['foo', 'bar', 'C:\\'] # Komodo change 127581 ['\\test\\slash', 'foo bar', 'foo"bar'] # Komodo change 127629 True True True """

    line = line.strip()
    argv = []
    state = "default"
    arg = None  # the current argument being parsed
    i = -1
    WHITESPACE = '\t\n\x0b\x0c\r '  # don't use string.whitespace (bug 81316)
    while 1:
        i += 1
        if i >= len(line): break
        ch = line[i]

        if ch == "\\" and i + 1 < len(line):
            # escaped char always added to arg, regardless of state
            if arg is None: arg = ""
            if (sys.platform == "win32" or
                    state in ("double-quoted", "single-quoted")
                ) and line[i + 1] not in tuple('"\''):
                arg += ch
            i += 1
            arg += line[i]
            continue

        if state == "single-quoted":
            if ch == "'":
                state = "default"
            else:
                arg += ch
        elif state == "double-quoted":
            if ch == '"':
                state = "default"
            else:
                arg += ch
        elif state == "default":
            if ch == '"':
                if arg is None: arg = ""
                state = "double-quoted"
            elif ch == "'":
                if arg is None: arg = ""
                state = "single-quoted"
            elif ch in WHITESPACE:
                if arg is not None:
                    argv.append(arg)
                arg = None
            else:
                if arg is None: arg = ""
                arg += ch
    if arg is not None:
        argv.append(arg)
    if not sys.platform == "win32" and state != "default":
        raise ValueError("command line is not terminated: unfinished %s "
                         "segment" % state)
    return argv