Write a script to parse a large log file, extract error messages, and count their frequency at Rippling.
Implement count_error_messages(log_lines), where log_lines is an iterable of strings. Each valid line has the format TIMESTAMP LEVEL MESSAGE, separated by spaces. Count only lines whose level is exactly ERROR, using the remaining text as the message. Ignore malformed lines, non-error levels, and errors with an empty message. Return a dictionary mapping each message to its frequency. Process the iterable once so the complete log does not need to be copied.
TIMESTAMP LEVEL MESSAGEdef count_error_messages(log_lines):