def METHOD_NAME(self, lines, i):
    """Parses a list."""
    line = lines[i]
    m = self.indent(line)
    kind = line[m]
    result = ["<li>" + line[m + 1 :].strip()]
    n = len(lines)
    j = i + 1
    while j < n:
        line = lines[j]
        k = self.indent(line)
        if k < m:
            break
        if k == m:
            if line[k] != kind:
                break
            result.append("<li>" + line[k + 1 :].strip())
            j += 1
        elif line[k] in "-*":
            j, line = self.METHOD_NAME(lines, j)
            result.append(line)
        else:
            result.append(line.strip())
            j += 1
    style = ["ul", "ol"][kind == "*"]
    return (j, list_template % (style, "\n".join(result), style))