def read_item(src):
def stringify(s):<EOL><INDENT>return TokenWithPosition.join(s.split('<STR_LIT:U+0020>'), glue='<STR_LIT:U+0020>')<EOL><DEDENT>def forward_until_new(s):<EOL><INDENT>"""<STR_LIT>"""<EOL>t = TokenWithPosition('<STR_LIT>', s.peek().position)<EOL>while (s.hasNext() and<EOL>any([s.peek().startswith(substr) for substr in string.whitespace]) and<EOL>not t.strip("<STR_LIT:U+0020>").endswith('<STR_LIT:\n>')):<EOL><INDENT>t += s.forward(<NUM_LIT:1>)<EOL><DEDENT>return t<EOL><DEDENT>arg = []<EOL>extra = []<EOL>if src.peek() in ARG_START_TOKENS:<EOL><INDENT>c = next(src)<EOL>a = read_arg(src, c)<EOL>arg.append(a)<EOL><DEDENT>if not src.hasNext():<EOL><INDENT>return extra, arg<EOL><DEDENT>last = stringify(forward_until_new(src))<EOL>extra.append(last.lstrip("<STR_LIT:U+0020>"))<EOL>while (src.hasNext() and not str(src).strip("<STR_LIT:U+0020>").startswith('<STR_LIT>') and<EOL>not src.startswith('<STR_LIT>') and<EOL>not src.startswith('<STR_LIT>') and<EOL>not (isinstance(last, TokenWithPosition) and last.strip("<STR_LIT:U+0020>").endswith('<STR_LIT>') and len(extra) > <NUM_LIT:1>)):<EOL><INDENT>last = read_tex(src)<EOL>extra.append(last)<EOL><DEDENT>return extra, arg<EOL>
r"""Read the item content.

    There can be any number of whitespace characters between \item and the first
    non-whitespace character. However, after that first non-whitespace
    character, the item can only tolerate one successive line break at a time.

    \item can also take an argument.

    :param Buffer src: a buffer of tokens
    :return: contents of the item and any item arguments