import re


def ParseOutput(lines):
    """
    Extracts L2 error, assembly and solve time, and number of
    iterations from the lines of a PETSC log file.
    """
    err = 0.
    ta = 0.
    p2 = r"L2\serror\s=\s(.*)"
    p3 = r"IGAFormSystem(.*)"
    for line in lines:
        m = re.search(p2,line)
        if m:
            err = float(m.group(1))
        m = re.search(p3,line)
        if m:
            ta = float(m.group(1).split()[2])
    return err,ta