Write a log parser in Python.
Asked in the Technical Evaluation stage.
Implement parse_logs(lines). Each valid line has the format <timestamp> <level> <message>, where timestamp is an ISO-8601 UTC value ending in Z, and level is one of INFO, WARN, ERROR, or DEBUG. Return a dictionary containing valid parsed records in input order, counts by level, and the number of malformed lines. Ignore malformed lines rather than raising an exception.
def parse_logs(lines):